On Tue, Dec 9, 2014, at 16:18, Duncan Booth wrote: > The default parameters are actually evaluated when the 'def' statement is > executed and the function object is created from the default arguments > and > the previously compiled code block.
Which means that if you execute the def statement [or lambda] more than once, you will get more than one instance of the default parameter. >>> def f(): return (lambda x={}: x) ... >>> f()() is f()() False >>> g = f() >>> g() is g() True -- https://mail.python.org/mailman/listinfo/python-list