[Python-Dev] PEP 309

Nick Coghlan ncoghlan at iinet.net.au
Sun Feb 27 08:39:26 CET 2005


Dima Dorfman wrote:
> Nick Coghlan <ncoghlan at iinet.net.au> wrote:
> Here, b is specialized at cut time, a is passed through the slot, and
> c is passed through the implicit slots at the end. The only thing this
> can't do is a generic right-"curry"--where we don't know how many
> parameters come before the one we want to specialize. If someone wants
> to do that, they're probably better off using keyword arguments.

I think Raymond posted some decent examples using the builtins where having 
binding of the last few arguments on the right with decent performance would be 
desirable. As you yourself said - Python functions tend to have the arguments 
one is most likely to want to lock down on the right of the function signature, 
rather than on the left.

The current PEP 309 certainly supports that in the form of keyword arguments, 
but anyone interested in performance is going to revert back to the lambda solution.

The class factory approach relies on shaping the partial application of the 
arguments by specifying where the call time positional arguments are to be 
placed (with 'all at the start', 'all at the end' and 'one at the start, rest at 
the end' being the most common options).

Regards,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net


More information about the Python-Dev mailing list