From 17964bc0283179f4cae347acd8ff6d5c632dfd72 Mon Sep 17 00:00:00 2001 From: Guillaume Chazarain Date: Sun, 2 Aug 2009 19:30:30 +0200 Subject: [PATCH] Use .__dict__ instead of [gs]etattr as it's slightly faster. --- iotop/data.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iotop/data.py b/iotop/data.py index dc98bd2..0c71315 100644 --- a/iotop/data.py +++ b/iotop/data.py @@ -65,9 +65,9 @@ class Stats(DumpableObject): """Returns a new Stats object built from operator(self, other_stats)""" delta_stats = Stats.__new__(Stats) for name, offset in Stats.members_offsets: - self_value = getattr(self, name) - other_value = getattr(other_stats, name) - setattr(delta_stats, name, operator((self_value, other_value))) + self_value = self.__dict__[name] + other_value = other_stats.__dict__[name] + delta_stats.__dict__[name] = operator((self_value, other_value)) return delta_stats def delta(self, other_stats): -- 2.11.4.GIT