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 <[email protected]> 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
--
http://mail.python.org/mailman/listinfo/python-list