[] and NoneType

beilin bzhang at sangamo.com
Tue Aug 20 21:44:12 EDT 2002


Hi,

Could anyone explain to me why [].append("test") returns None? What is
the difference between the following two?
>>> a = []
>>> a.append("test")
>>> print a
['test']
>>>

and 

>>> a = [].append("test")
>>> print a
None
>>>

I am confused.  Thanks

Beilin



More information about the Python-list mailing list