__iadd__ and fellows missing (Python 2.2)
Michael Hudson
mwh at python.net
Fri Apr 12 11:54:28 EDT 2002
Ralf Juengling <juenglin at informatik.uni-freiburg.de> writes:
> Shouldn't I find the special methods '__iadd__' et al, when
> asking for the attributes of 'int'?
ints are immutable, so they don't implement __iadd__. lists do:
>>> [].__iadd__
<method-wrapper object at 0x8145f24>
> I couldn't find them either in ther operator-module:
Hmm, I think the issue here is that
x += y
translates (in the presence of an __iadd__ method) roughly to
x = x.__iadd__(x, y)
and you can't do that in the form of
operator.blah(x,y)
. Or it might just be oversight.
Cheers,
M.
--
Remember - if all you have is an axe, every problem looks
like hours of fun. -- Frossie
-- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html
More information about the Python-list
mailing list