Partially evaluated functions
Scott David Daniels
Scott.Daniels at Acm.Org
Sat Jul 7 23:07:26 EDT 2001
You might make this slightly more readable with:
> def curry(*args, **create_time_kwds):
> func = args[0]
> create_time_args = args[1:]
> ...
=============
def curry(func, *args, **create_time_kwds):
create_time_args = args[:]
...
Depending upon how this gets used, you might be safe
not even performing the copy, so you'd get:
=============
def curry(func, *create_time_args, **create_time_kwds):
...
The reason for the "depending upon, ..." has to do with whether
"list + []" must always produce a new list, or is allowed to notice
that [] is 0-length and simply returns the first list. With a copy,
you are safe for sure. Similar strictures should apply about your
proposed (dict1 + dict2) behavior. We'd need to define whether
a new value _must_ be produced.
-Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list