Python Gotcha's?

Michael Hrivnak mhrivnak at hrivnak.org
Thu Apr 5 14:52:00 EDT 2012


I'm surprised nobody beat me to posting this:

>>> def foo(stuff=[]):
...  stuff.append('bar')
...  print stuff
...
>>> foo()
['bar']
>>> foo()
['bar', 'bar']
>>> foo()
['bar', 'bar', 'bar']


On Wed, Apr 4, 2012 at 6:34 PM, Miki Tebeka <miki.tebeka at gmail.com> wrote:
> Greetings,
>
> I'm going to give a "Python Gotcha's" talk at work.
> If you have an interesting/common "Gotcha" (warts/dark corners ...) please share.
>
> (Note that I want over http://wiki.python.org/moin/PythonWarts already).
>
> Thanks,
> --
> Miki
> --
> http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list