copysort patch, was RE: [Python-Dev] inline sort option

Alex Martelli aleaxit at yahoo.com
Tue Oct 28 16:46:50 EST 2003


On Tuesday 28 October 2003 06:42 pm, Guido van Rossum wrote:
> > Hmmm... maybe one COULD make a custom descriptor that does support
> > both usages... and maybe it IS worth making the .sorted (or whatever
> > name) entry a case of exactly such a subtle custom descriptor...
>
> Thanks for the idea, I can use this as a perverted example in my talk
> at Stanford tomorrow.  Here it is:

Heh, cool!

> import new
>
> def curry(f, x, cls=None):
>     return new.instancemethod(f, x)

Hmmm, what's the role of the ", cls=None" argument here...?  I.e,
couldn't just

curry = new.instancemethod

be equivalent?


Alex




More information about the Python-Dev mailing list