A critic of Guido's blog on Python's lambda

Alex Martelli aleax at mac.com
Tue May 9 02:15:54 EDT 2006


M Jared Finder <jared at hpalace.com> wrote:
   ...
> Any time you want an anonymous function (or class, or type, or number)
> it would be because that thing is sufficiently small and simple that the
> best name for it is the code itself.  In one game I worked on, there was

That's not what I see happen in practice in the real world -- please
check this thread for the guy who pointed me at some Lisp code of his to
draw pictures, and how each anonymous function is code returned had a
nice little comment (which would yield a perfectly suitable name, as I
showed in a Python translation of one of them).  In the real world,
people don't choose anonymous functions only in these alleged cases
where anonymous is best -- if anonymous functions are available, they're
used in even more cases where naming would help (just as, again in the
real world, plenty of "magic numbers" sully the code which SHOULD be
named... but just don't GET named).

BTW, in your case canPerformQueuedAction seems a good name to me (I'd
probably eliminate the 'Action' part, since the _argument_ is an Action,
but I'd need to see more context to suggest the best name).


Alex



More information about the Python-list mailing list