[Python-ideas] proto-PEP: Fixing Non-constant Default Arguments

Jim Jewett jimjjewett at gmail.com
Tue Jan 30 00:11:11 CET 2007


On 1/29/07, Roman Susi <rnd at onego.ru> wrote:

> P.S. However, I may be wrong. In that case my syntax suggestion would be
> this:

> def foo(non_const or []):
>     ...
>
> where [] is executed at runtime BECAUSE at def time non_const is somehow
> True and that is enough to leave [] alone.

It would also be possible to treat literals (like "[]") as "do it over
each time", and more general expressions (like "list()") as they are
treated today.

Though like Roman, I think this would still be worse than the status quo.

-jJ



More information about the Python-ideas mailing list