On Wed, 2006-09-27 at 09:32 -0700, [EMAIL PROTECTED] wrote:
> So I just got bitten by the "don't use a mutable object as an optional
> argument" gotcha.  I now realize that for this function:
> 
> >>> def func(x, y=[]):
> ...     y.append(x)
> ...     print y
> ...
> 
> y is initialized when the function is imported, not when the function
> is executed.

I thought it was initialised the first time the function gets called?

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

Reply via email to