[issue3178] __radd__(self, other) isn't called if self and other are of the same class

Pyry Pakkanen report at bugs.python.org
Mon Jun 23 15:01:19 CEST 2008


New submission from Pyry Pakkanen <frostburn at suomi24.fi>:

>>> class test: 
... 	def __radd__(self,other):
... 		return '__radd__ called'
... 
>>> t = test()
>>> 1 + t
'__radd__ called'
>>> t + t
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'test' and 'test'


This applies to all of the reflected operations.

----------
messages: 68625
nosy: Frosburn
severity: normal
status: open
title: __radd__(self,other) isn't called if self and other are of the same class
versions: Python 2.5, Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3178>
_______________________________________


More information about the Python-bugs-list mailing list