Jim Jewett wrote:
On 1/29/07, Roman Susi firstname.lastname@example.org 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.
As discussed in the proto-PEP, there are many cases where non-literal default values need to be re-evaluated at each call. A solution to this problem needs to take this into account. Also, the proto-PEP's proposal tries to have the behavior of default arguments be as uniform as possible and not "magically" decide the correct behavior, especially by using something as arbitrary as what expression is used for the default argument.
- Chris Rebert