YAI: syntax for preset locals without using dummy args with defaults

Skip Montanaro skip at pobox.com
Fri Jan 10 17:05:09 CET 2003


    Bengt> Right now we often see

    Bengt>     def foo(x, y=default, z=some_expression):
    Bengt>         ...

    Bengt> where the purpose is not to have three parameters, but two plus a
    Bengt> local binding (z) in foo to the value of some_expression
    Bengt> evaluated in the def-time environment. 

This is just a performance hack and should be addressed by other means,
e.g., more efficient access to global variables.  See, for example, PEPs 266
and 267.  I believe other not-yet--PEPped proposals have been floated as
well.

Skip





More information about the Python-list mailing list