[Tutor] assignment question

Jeff Younker jeff at drinktomi.com
Mon Nov 12 05:49:52 CET 2007


Append modifies the array as a side effect.  It has no
meaningful return value.

 >>> x = [1, 2, 3]
 >>> x.append(4)
 >>> print x
[1, 2, 3, 4]

- Jeff Younker - jeff at drinktomi.com - 510.798.5804 -


On Nov 11, 2007, at 8:21 PM, Ryan Hughes wrote:

>
> Hello,
>
> Why does the following not return [1,2,3,4] ?
>
> >>> x = [1,2,3].append(4)
> >>> print x
> None
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071111/f3968169/attachment-0001.htm 


More information about the Tutor mailing list