From: Zac Medico Date: Fri, 20 May 2011 20:40:13 +0000 (-0700) Subject: Task: optimize == and != _hash_key comparison X-Git-Tag: v2.2.0_alpha35~36 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fc199d55f5c293c4cef43b4fdd6a560e97f272d8;p=portage.git Task: optimize == and != _hash_key comparison --- diff --git a/pym/_emerge/Task.py b/pym/_emerge/Task.py index 4dbdb1185..3e1a4ba62 100644 --- a/pym/_emerge/Task.py +++ b/pym/_emerge/Task.py @@ -6,10 +6,16 @@ class Task(SlotObject): __slots__ = ("_hash_key", "_hash_value") def __eq__(self, other): - return self._hash_key == other + try: + return self._hash_key == other._hash_key + except AttributeError: + return False def __ne__(self, other): - return self._hash_key != other + try: + return self._hash_key != other._hash_key + except AttributeError: + return True def __hash__(self): return self._hash_value