[] and NoneType

beilin bzhang at sangamo.com
Wed Aug 21 03:44:12 CEST 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