[prev in list] [next in list] [prev in thread] [next in thread]
List: pypy-svn
Subject: [pypy-svn] r8764 - pypy/dist/pypy/lib
From: pedronis () codespeak ! net
Date: 2005-01-31 17:32:07
Message-ID: 20050131173207.DF7CF27B71 () code1 ! codespeak ! net
[Download RAW message or body]
Author: pedronis
Date: Mon Jan 31 18:32:07 2005
New Revision: 8764
Modified:
pypy/dist/pypy/lib/_classobj.py
Log:
inplace operators
Modified: pypy/dist/pypy/lib/_classobj.py
==============================================================================
--- pypy/dist/pypy/lib/_classobj.py (original)
+++ pypy/dist/pypy/lib/_classobj.py Mon Jan 31 18:32:07 2005
@@ -365,3 +365,16 @@
""") % {"op": op, "op2": (op, op+'_')[op in ('and', 'or', 'not')]}
del op
+
+ # inplace operators
+ for op in 'mod and pow truediv lshift xor rshift floordiv div sub mul add or'.split():
+ exec ("""
+def __i%(op)s__(self, other):
+ func = instance_getattr1(self, '__i%(op)s__', False)
+ if func:
+ return func(other)
+ return NotImplemented
+
+""") % {"op": op}
+ del op
+
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic