List mutation method gotcha - How well known?

Paul Rubin http
Thu Mar 13 06:49:14 EDT 2008


Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:

> "Hendrik van Rooyen" <mail at microcorp.co.za> writes:
> > Given the following three lines of code at the interactive prompt:
> > 
> > foo = [1,2,3,4]
> > x = foo.append(5)
> > print x
> > 
> > What will be the output (choose one):
> > 4)  Nothing - no output

Correction, it will print None, there is an explicit print statement
that went past me.  I'm sleepy.



More information about the Python-list mailing list