Partially evaluated functions

Rainer Deyke root at rainerdeyke.com
Sun Jul 8 17:42:34 CEST 2001


"Scott David Daniels" <Scott.Daniels at Acm.Org> wrote in message
news:tkfjjaj9irlm7b at corp.supernews.com...
> 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[:]
>      ...

It has already been pointed out that this is broken if "func" is used as a
keyword argument:

curry(f, func=g)

> Depending upon how this gets used, you might be safe
> not even performing the copy, so you'd get:

The copy is never necessary.  'args' is a tuple and therefore immutable.


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list