Skip to content

Commit 41ff375

Browse files
committed
Allow accessing Object fields using square brackets
1 parent 83c4ba8 commit 41ff375

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pyrogram/api/core/object.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ def __len__(self) -> int:
4646
def __call__(self):
4747
pass
4848

49+
def __getitem__(self, item):
50+
return getattr(self, item)
51+
4952

5053
class Encoder(JSONEncoder):
5154
def default(self, o: Object):

0 commit comments

Comments
 (0)