News for hackers. Stuff that matters.
Re:What Python learned from economics by mindslight on Tuesday November 18, 2008 @05:56PM (#368864)
> It is by design that the default parameter to a function parameter is evaluated only once, as the alternative has bad performance implications.

Do people actually use the results of long-running or side-effectful functions as default parameters? It seems the only time this issue comes up is when people get tripped up by mutating simple [] or {} default parameters.

I would expect a default expression to be simple and pure. If this expression should only be executed once, requiring a programmer to be explicit about the complexity wouldn't be a bad thing.

Re:What Python learned from economics by etal on Tuesday November 18, 2008 @06:15PM (#368884)
It can be a cute hack to get around the absence of static variables.

Lists have other quirks related to mutability; there are other obscure Pythonisms that use this. If you want a nice magic-free immutable container, tuples are a better bet.

Re:What Python learned from economics by ivankirigin on Tuesday November 18, 2008 @11:24PM (#369128)
I often evolve type in a single var into something more complex,

    foo = makeSomethingDifferent( foo )
And I need to catch myself when foo is a default param