Inconsistent reaction to extend
Jerzy Karczmarczuk
karczma at info.unicaen.fr
Fri Sep 9 05:47:41 EDT 2005
Gurus, before I am tempted to signal this as a bug, perhaps
you might convince me that it should be so. If I type
l=range(4)
l.extend([1,2])
l gives [0,1,2,3,1,2], what else...
On the other hand, try
p=range(4).extend([1,2])
Then, p HAS NO VALUE (NoneType).
With append the behaviour is similar. I didn't try other methods, but
I suspect that it won't improve.
WHY?
It seems that there was already some discussion about consistency and
somebody produced the example: h = {}.update(l) which didn't work,
but I wasn't subscribed to this nsgr, I couldn't follow this affair.
Jerzy Karczmarczuk
More information about the Python-list
mailing list