Use .items() to get rid of a call to getattr

This commit is contained in:
Jonathan Reichelt Gjertsen 2019-09-08 17:14:32 +02:00 committed by Ram Rachum
parent b4b425c652
commit 7222d78a83
1 changed files with 1 additions and 2 deletions

View File

@ -233,8 +233,7 @@ class Tracer:
return self._wrap_function(function_or_class)
def _wrap_class(self, cls):
for attr_name in cls.__dict__:
attr = getattr(cls, attr_name)
for attr_name, attr in cls.__dict__.items():
if inspect.isfunction(attr):
setattr(cls, attr_name, self._wrap_function(attr))
return cls