15759 defining __eq__ to use isinstance causes recursion
authorBart Smaalders <Bart.Smaalders@Sun.COM>
Wed, 28 Apr 2010 10:48:43 -0700
changeset 1881 6120f2c6b4cb
parent 1880 684773e8a373
child 1882 cfb1f0e515fd
15759 defining __eq__ to use isinstance causes recursion
src/modules/actions/generic.py
--- a/src/modules/actions/generic.py	Wed Apr 28 15:30:14 2010 +0100
+++ b/src/modules/actions/generic.py	Wed Apr 28 10:48:43 2010 -0700
@@ -21,8 +21,7 @@
 #
 
 #
-# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
 #
 
 """module describing a generic packaging object
@@ -235,17 +234,12 @@
 
                 return out
 
-        def __eq__(self, other):
-                if isinstance(other, Action):
-                        return cmp(self, other) == 0
-                return False
-
         def __cmp__(self, other):
                 """Compare actions for ordering.  The ordinality of a
                    given action is computed and stored at action
                    initialization."""
                 if not isinstance(other, Action):
-                        return cmp(id(self), id(other))
+                        return NotImplemented
 
                 res = cmp(self.ord, other.ord)