"Collapsing" a list into a list of changes
Steven Bethard
steven.bethard at gmail.com
Mon Feb 7 15:21:10 EST 2005
Francis Girard wrote:
> Le lundi 7 Février 2005 20:30, Steven Bethard a écrit :
>>especially since I avoid lambda usage, and would have to write these as:
>
> Why avoid "lambda" usage ? You find them too difficult to read (I mean in
> general) ?
Yup, basically a readability thing. I also tend to find that if I
actually declare the function, I can often find a way to refactor things
to make that function useful in more than one place.
Additionally, 'lambda' is on Guido's regrets list, so I'm avoiding it's
use in case it gets yanked for Python 3.0. I think most code can be
written now without it, and in most cases code so written is clearer.
Probably worth looking at is a thread I started that went through some
stdlib uses of lambda and how they could be rewritten:
http://mail.python.org/pipermail/python-list/2004-December/257990.html
Many were rewritable with def statements, list comprehensions, the
operator module functions, or unbound or bound methods.
Steve
More information about the Python-list
mailing list