From 7222d78a8332a1d34c939dde5d980e38a7ec2bb4 Mon Sep 17 00:00:00 2001 From: Jonathan Reichelt Gjertsen Date: Sun, 8 Sep 2019 17:14:32 +0200 Subject: [PATCH] Use .items() to get rid of a call to getattr --- pysnooper/tracer.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pysnooper/tracer.py b/pysnooper/tracer.py index d8f5ba4..0be0bba 100644 --- a/pysnooper/tracer.py +++ b/pysnooper/tracer.py @@ -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