[Python-Dev] Chaining seq1.pop().extend(seq2) does give wrong result

Jacek Trzmiel sc0rp at hot.pl
Tue Mar 23 09:54:08 EST 2004


Hi,

$ python
Python 2.3.2 (#1, Dec  5 2003, 03:04:50) 
[GCC 3.3.3 [FreeBSD] 20031106] on freebsd5
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> stack = [[1], [2]]
>>> fields = [3]
>>> out = stack.pop()
>>> out.extend(fields)
>>> print out
[2, 3]
>>> 
>>> stack = [[1], [2]]
>>> fields = [3]
>>> out = stack.pop().extend(fields)
>>> print out
None
>>> 

Shouldn't those two give identical result?

Best regards,
Jacek.




More information about the Python-Dev mailing list