List mutation method gotcha - How well known?

BJörn Lindqvist bjourne at gmail.com
Thu Mar 13 11:06:48 EDT 2008


On Thu, Mar 13, 2008 at 8:36 AM, Hendrik van Rooyen
<mail at microcorp.co.za> wrote:
>  foo = [1,2,3,4]
>  x = foo.append(5)
>  print x
>
>  What will be the output (choose one):
>
>  1)  [1,2,3,4]
>  2)  [1,2,3,4,5]
>  3)  That famous picture of Albert Einstein sticking out his tongue
>  4)  Nothing - no output
>  5)  None of the above

5


-- 
mvh Björn



More information about the Python-list mailing list