
Jan. 18, 2007
1:44 p.m.
Calvin Spealman wrote:
I dont understand how that would be different than doing
c = c if c is not None else Bar([2,3,4])
Because that would be calling Bar(), perhaps creating a new Bar object, every time foo() is called with None for c, which is not what a default argument values are about. I'm proposing a way to create function local singleton objects, removing them from the parameter list. def foo(x): local history = [] history.append(x) Rather than: def foo(x, history=[]): history.append(x) and then hoping that nobody calls foo() with a history parameter. Joel