Message2061
 
            
            
            
 
   
   
 
 
  
      
__add__ and other binary ops are translated from the compiler into a call of their wrapper method (for __add__ that wrapper method is PyObject._add). These wrapper methods call into their dunder methods (like __add__) via PyObject's _binop_rule. binop_rule manages cases like this: i.e. trying alternative means, such as __radd__, if __add__ returns NotImplemented
Unfortunately the inplace operations are being translated directly into a PyObject.__iadd__ method call (there is no __iadd). That's why jek's example just returns the NotImplemented directly -- it should have at least raised a TypeError.
It looks like we need a similar wrapper for inplace ops, i.e. _iadd, that probably needs to utilize _binop_rule. If we do utilize _binop_rule for all inplace ops, then we also need to be expose the inplace methods as binary (type = MethodType.BINARY, or expose_binary in the old expose templates)  | 
   
  
 
|
 
| Date | 
User | 
Action | 
Args | 
 
| 2008-02-20 17:18:09 | admin | link | issue1873148 messages |  
| 2008-02-20 17:18:09 | admin | create |  |  
 
 
 |