On Thu, 21 Oct 2010 19:53:53 -0700 John Nagle <na...@animats.com> wrote:

> On 10/21/2010 2:51 PM, Chris Rebert wrote:
> > On Thu, Oct 21, 2010 at 2:36 PM, Sean Choi<gne...@gmail.com>  wrote:
> >> I found two similar questions in the mailing list, but I didn't
> >> understand the explanations.
> >> I ran this code on Ubuntu 10.04 with Python 2.6.5.
> >> Why do the functions g and gggg behave differently? If calls
> >> gggg(3) and g(3) both exit their functions in the same state, why
> >> do they not enter in the same state when I call gggg(4) and g(4)?
> >>
> >> #
> >> ----------------------------------------------------------------------
> >> my code: def gggg(a, L=[]):
> >
> > This is a common newbie stumbling-block: Don't use lists (or
> > anything mutable) as default argument values
> 
>      That really should be an error.
> 
What do you mean? That using a list as default arguments should throw
an error?

While not very commonly needed, why should a shared default argument be
forbidden?

/W

-- 
To reach me via email, replace INVALID with the country code of my home 
country.  But if you spam me, I'll be one sour Kraut.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to