I ran into a similar situation like the following (ipython session).
Can anyone please explain why the behavior?
Thanks in advance.

In [11]: def foo(b=[]):
   ....:     b.append(3)
   ....:     return b
   ....:

In [12]: foo()
Out[12]: [3]

In [13]: foo()
Out[13]: [3, 3]

In [14]: foo([])
Out[14]: [3]

In [15]: foo([])
Out[15]: [3]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to