lambda in list comprehension acting funny
Robert Kern
robert.kern at gmail.com
Thu Jul 12 05:06:53 EDT 2012
On 7/11/12 9:21 PM, John Ladasky wrote:
> Exactly. It's threads like these which remind me why I never use lambda. I would rather give a function an explicit name and adhere to the familiar Python syntax, despite the two extra lines of code. I don't even like the name "lambda". It doesn't tell you what it is (unless you're John McCarthy), a function that you won't re-use and so you don't really need to give it a persistent name.
>
> I haven't seen any lambdas in any Python library code, or in any of the third-party modules I use (numpy, matplotlib, Biopython). Do they exist? Because I have not been forced to do so, I haven't retained a space in the top drawer of my programming brain for lambda.
I count 162 uses in the Python standard library, 69 uses in numpy, 108 in
matplotlib, and 238 uses in Biopython. Adding in the unit tests for each would
add significantly to those counts.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list