TelegramObject.to_dict(): use iterators

This commit is contained in:
Noam Meltzer 2016-04-25 13:15:54 +03:00
parent e9a782a3c8
commit 8ff8d57998

View file

@ -64,7 +64,8 @@ class TelegramObject(object):
"""
data = dict()
for key, value in self.__dict__.items():
for key in iter(self.__dict__):
value = self.__dict__[key]
if value or value == '':
if hasattr(value, 'to_dict'):
data[key] = value.to_dict()