[Python-Dev] Right curry considered harmful
Alex Naanou
alex.nanou at gmail.com
Tue Aug 31 22:59:10 CEST 2004
On Tue, 31 Aug 2004 21:24:29 +0100, Peter Harris <scav at blueyonder.co.uk> wrote:
> I think we'll see if partial() is a useful enough feature to be worth optimising once it
> actually makes it into a build and gets used.
I for one use the beast quite allot! :)
> Mostly I think nesting many layers of partial(), or optimising the implementation with
> that in mind will not be a win for clarity, therefore a net loss however fast you can
> make it.
well, about clarity, the implementation I posted above is actual code
form the library I am writing (pli.sf.net), I could write a clearer
and *prettier* version with the same functionality if desired...
...why intentionally make an under-designed version when adding some
minor optimisations would not impact either clarity nor efficiency
(IMHO).
> By the way, I think 'right curry' is just a broken idea from the point of view of
> code readability. (I know the n'th argument is '2', but 'n' will depend on how
> many arguments are passed at run time!) The PEP doesn't propose to implement
> such a monster, or call partial() a curry at all, let alone a 'left' one.
in part I do agree, but I had to implement both as going the other way
would have been a big (and I do mean BIG) loss in both clarity an
flexibility.
---
Alex.
More information about the Python-Dev
mailing list