Ryan Hughes wrote:
> Hello,
> 
> Why does the following not return [1,2,3,4] ?
> 
>>>> x = [1,2,3].append(4)
>>>> print x
> None

because the append() method doesn't return a copy of the list object; it 
just modifies the list itself.

so your code constructs a list object with 3 elements, appends a fourth 
element to it, and throws that list object away, keeping only the return 
value of append().

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to