[Python-Dev] Re: accumulator display syntax

Alex Martelli aleaxit at yahoo.com
Sun Oct 26 12:51:04 EST 2003


On Sunday 26 October 2003 06:34 pm, Raymond Hettinger wrote:
   ...
> b to be Sets; however, a.union(b) allows b to be any iterable.  The
> matches the distinction between list.__iadd__() and list.extend() where
> the former requires a list argument and the latter does not.

What distinction...?

>>> x=range(3)
>>> x.__iadd__('foo')
[0, 1, 2, 'f', 'o', 'o']
>>> x
[0, 1, 2, 'f', 'o', 'o']
>>>

did you mean list.__add__()...?  list.__iadd__ IS just as permissive
as list.extend, it seems to me.


Alex




More information about the Python-Dev mailing list