PEP 309 - Built-in closure type (with tentative syntax proposal)
Peter Harris
scav at blueyonder.co.uk
Tue Feb 18 08:04:38 EST 2003
Alex Martelli <aleax at aleax.it> wrote in message news:<XwV1a.217687$AA2.8558127 at news2.tin.it>...
>
> It wouldn't be a bad idea, except for the name (which should
> be curry, not 'closure'). The type should live in a standard
> library module -- it's not going to be used often enough to
> make it a built-in.
>
OK, I'll change the PEP to suggest 'curry' as the preferred name
since enough people have set me straight on that one.
Curried functions are a bit like list comprehensions in that a
beginner won't immediately see the point, but once you find out
what they are good for, you wonder how you did without them.
If you get them for free as a built-in, they will be used more
than if you have to code them yourself. How much is often enough?
Who knows? But I don't see the point of another standard library
module with only one type in it, just so I have to do
import curry from curry
at the top of most of my non-trivial programs.
> > Is the @ syntax too ugly to be worth it?
>
> It's ugly, unpythonic, and absolutely unwarranted besides:
OK it's ugly. It's unpythonic too in that Python doesn't do it
at the moment. But no other language does either, so if Python
did, the @ would be de facto *uniquely* Pythonic :)
However we have hash-table literals, tuple literals and list
literals all neatly differentiated by punctuation rather than
named constructors. It's probably not too big a stretch to
have functional-section literals too, if they were going to be
useful enough.
Apparently everyone thinks they would not, and I am not pushing
for it. It was probably not such a good idea.
>
> Alex
Peter Harris
More information about the Python-list
mailing list