What's Going On?

MartinRinehart at gmail.com MartinRinehart at gmail.com
Thu Mar 13 06:53:13 EDT 2008


(Accompanied by Marvin Gaye)

>>> def f(list=[0]):
...    list[0]+=1
...    return list[0]
...
>>> f()
1
>>> f()
2
>>> f() # 'list' is a name bound to a list (mutable) so this makes sense
3
>>> f([5])
6
>>>f() # What's Going On?
4

Off topic: Motown chief Berry Gordy tells Gaye he won't release the
"uncommercial" song. Gaye tells Gordy
he'll never have another Gaye song if he doesn't release it. Gordy
backs down. 2.5 million singles plus title
track for blockbuster album.



More information about the Python-list mailing list