On 5/23/2012 5:23 AM 水静流深 said...
>>> s=[1,2,3] >>> s.append(5) >>> s [1, 2, 3, 5] >>> s=s.append(5) >>> s >>> print s Nonewhy can't s=s.append(5)
It could, but it doesn't.
,what is the reason?
A design decision -- there's currently a mix of methods that return themselves and not. Mostly is appears to me that mutables modify in place without returning self and immutables return the new value.
But that's simply my observation. Emile -- http://mail.python.org/mailman/listinfo/python-list