syntax for preset locals without using dummy args with defaults
Andrew Dalke
adalke at mindspring.com
Sat Jan 11 15:47:08 EST 2003
Bengt Richter wrote:
> My first choice would be a new keyword to provide a place other than the parameter
> list to specify the def-time code that generates the local bindings in question
> (e.g., z above):
>
> def foo(x, y=default):
> preset: z=some_expression
> ...
Tangenting somewhat, here's one which doesn't have a new keyword.
Kinda ugly though
def spam(x, y = default):
def z = some_expression
return x*y*z
Ugh, ugh, no, I take that suggestion back. Blech.
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list