explain this function to me, lambda confusion

Terry Reedy tjreedy at udel.edu
Mon May 19 09:06:50 EDT 2008


"Arnaud Delobelle" <arnodel at googlemail.com> wrote in message 
news:6062786d-6f83-4850-bf55-4db4ec27bdea at b1g2000hsg.googlegroups.com...
| On May 19, 5:22 am, "Terry Reedy" <tjre... at udel.edu> wrote:
| > "Arnaud Delobelle" <arno... at googlemail.com> wrote in message
| [...]
| > | Note that the same thing can be said about generator expressions,
| > | which are nothing more than anonymous, non-reusable, generator
| > | functions.
| >
| > Right.  So if someone posted on genexp confusion, I would suggest
| > 'write a full generator function'.
|
| I was just arguing against arguing for the removal of lambda on the
| basis that it doesn't add any functionality to the language!

I sort of understood that ;-)
Like Guido, I am split on keep/remove.
However, I have decided to leave lambda out of my Python-subset 
executable-pseudocode algorithm language.  I have not decided whether or 
not to include genexps.

| > | Instead these were _added_ to the language!
| >
| > As a convenience.
| > Actually, if one uses more that one for-clause in a generator 
expression,
| > there is a potential gotcha in relation to name capture.  So if that 
bites,
| > the genexp is not so much a convenience, and one might better write
| > the full function.

| Yes, IMHO this is a bug, and I wish I had the time to dive into the
| code to see if I can fix it.

If I do include them, I might restrict them to one for-clause because of 
that glitch, whose details I keep forgetting.

tjr
| 






More information about the Python-list mailing list