[Python-3000] A plea for anonymous functions

Brett Cannon brett at python.org
Fri Nov 17 22:44:33 CET 2006


On 11/17/06, Talin <talin at acm.org> wrote:
>
> Fredrik Lundh wrote:
> > Talin wrote:
> >
> >> I expect to see a series of special-case syntactical work-arounds that
> >> compensate for the lack of such a feature.
> >
> > yeah, because the "special-case syntactical work-arounds" are care-
> > fully designed to be *usable* for a well-defined group of *practical*
> > problems.  it's about HCI, not CS.
> >
> > please get over this "all I have is a hammer that my CS teacher told
> > me to use" mode of thinking; we're designing for humans, not wannabe
> > language designers who believe in "the one true mechanism".  there are
> > plenty of other reli^h^h^h^hlanguages for that kind of thinking.
>
> I don't think that anyone has really answered my fundamental question
> yet, which is this: Python is my favorite language, but I use a lot of
> other languages as well, and there's one feature that I use a lot in
> those other languages which I miss not having in Python. How is it that
> people are so hostile to something that I, and apparently others, find
> so useful?


Because we have gone down this road on this topic so many times.  This is
why Guido declared that lambda would not change; it would neither gain nor
lose any abilities (except maybe requiring parentheses around its
arguments).  No one has come up with a good solution, but plenty of people
have said, "this is a marvelous feature and as soon as we have it we can do
so much!"  Well, that's fine but you need to have the good solution before
it will be considered. <South Park reference>You need to know what you are
going to do with the underpants before you can get rich</reference>.

As Fredrik said, we worry more about HCI than CS.  Stating multi-line
anonymous functions are a great solution to all of these issues is fine from
a theoretical point of view.  But the key point is that Python puts
usability/practicality before purity.  In terms of this argument, it is
manifesting itself as resistance to this idea without a concrete proposal
for the syntax that people actually like.  And that is going to be damn hard
when every proposal so far for multi-line anonymous functions has been ugly
and not very usable.

So one must worry about the usability aspect of this proposal first instead
of what it might buy us because if it ain't usable then it ain't worth
anything in Pythonland.  You have the rationale behind wanting this, which
is great and is a good start on a PEP.  But now you need to come up with how
this feature will manifest itself in the code and be usable.  Once you have
that all wrapped up in a PEP then people will probably be more receptive to
discussing this whole matter.

-Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20061117/38a4ad2e/attachment.html 


More information about the Python-3000 mailing list