default method parameter behavior
Jerry Hill
malaclypse2 at gmail.com
Wed Apr 2 16:50:03 EDT 2008
On Wed, Apr 2, 2008 at 3:59 PM, <jianbing.chen at gmail.com> wrote:
> I ran into a similar situation like the following (ipython session).
> Can anyone please explain why the behavior?
http://www.python.org/doc/faq/general/#why-are-default-values-shared-between-objects
Since you got bitten by this, you may also find it useful to take a
look at one of the pages that talks about common python problems, like
http://zephyrfalcon.org/labs/python_pitfalls.html or
http://www.ferg.org/projects/python_gotchas.html (both of which
mention the problems with mutable default arguments).
--
Jerry
More information about the Python-list
mailing list