On Sat, Jan 30, 2010 at 4:32 PM, Dan Brown <fsenz...@gmail.com> wrote:
> Why does extending a list with the empty list result in None?  It
> seems very counterintuitive to me, at least --- I expected ['a'].extend
> ([]) to result in ['a'], not None.

Extend is a method of the list. The list itself is changed, it does
not return itself:

>>> A = [1,2]
>>> B = [3,4]
>>> C = A.extend(B)
>>> C
>>> C is None
True
>>> A
[1, 2, 3, 4]


Thus, nothing special about extend([]), this is the general behaviour of extend

-- 
André Engels, andreeng...@gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to