[pypy-svn] r8847 - pypy/dist/pypy/lib

arigo at codespeak.net arigo at codespeak.net
Fri Feb 4 13:43:47 CET 2005


Author: arigo
Date: Thu Feb  3 21:59:15 2005
New Revision: 8847

Modified:
   pypy/dist/pypy/lib/_classobj.py
Log:
divmod() and cmp() are not in the operator module.


Modified: pypy/dist/pypy/lib/_classobj.py
==============================================================================
--- pypy/dist/pypy/lib/_classobj.py	(original)
+++ pypy/dist/pypy/lib/_classobj.py	Thu Feb  3 21:59:15 2005
@@ -363,7 +363,7 @@
             return func(other)
         return NotImplemented
     else:
-        return operator.%(op2)s(self, other)
+        return %(module)s%(op2)s(self, other)
 
 def __r%(op)s__(self, other):
     coerced = coerce(self, other)
@@ -373,8 +373,9 @@
             return func(other)
         return NotImplemented
     else:
-        return operator.%(op2)s(other, self)
-""") % {"op": op, "op2": (op, op+'_')[op in ('and', 'or', 'not')]}
+        return %(module)s%(op2)s(other, self)
+""") % {"op": op, "op2": (op, op+'_')[op in ('and', 'or', 'not')],
+        "module": ('operator.', '')[op == 'divmod']}
     del op
 
 
@@ -491,7 +492,7 @@
             v = coerced[0]
             w = coerced[1]
             if not isinstance(v, instance) and not isinstance(w, instance):
-                return operator.cmp(v,w)
+                return cmp(v,w)
         if isinstance(v, instance):
             func = instance_getattr1(v, '__cmp__', False)
             if func:



More information about the Pypy-commit mailing list