__iadd__ useless in sub-classed int
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Fri Dec 7 01:45:41 EST 2007
En Fri, 07 Dec 2007 03:01:28 -0300, MonkeeSage <MonkeeSage at gmail.com>
escribió:
> I've wondered about this myself. Seems to me, to prevent clobbering
> subclasses, __iadd__ (and all of the integer and float and whatever)
> methods that return new instances, should work like this (obviously I
> mean in the C backend, this is just to show the behavior):
>
> def __iadd__(self, other):
> return self.__class__(self + other)
This would slow down *all* of Python, and is only useful for those who
actually inherit from some builtin class (not so common)
--
Gabriel Genellina
More information about the Python-list
mailing list