feature request: parameter functions

Skip Montanaro skip at pobox.com
Fri Aug 17 22:51:56 EDT 2001


    Steven> A feature idea for Python.  Right now, you can specify default
    Steven> parameters in functions and these parameters can be functions,
    Steven> but this is of limited value, since the function is evaluated at
    Steven> the time the def statement is initially executed.  I'd like
    Steven> these function parameters to be dynamically evaluated, and I'd
    Steven> like to take it a step farther so that it's not strictly a
    Steven> default parameter issue.  Specifically, I'd like to be able to
    Steven> pass any of the parameter values to the function if they WERE
    Steven> specified.
    ...
    Steven> Thoughts, comments?

Sounds kind of like you want thunks or curried functions.  I've never been
real clear on the distinctions.  I believe Alex Martelli added a curry class
implementation to the ActiveState Python Cookbook.  Check that out and see
if it doesn't do what you want.

-- 
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list