PEP 312 - Making lambdas implicit worries me, surely it's just the name 'lambda' that is bad...

Alexander Schmolck a.schmolck at gmx.net
Mon Mar 3 17:28:21 EST 2003


Dave Brueck <dave at pythonapocrypha.com> writes:

> > I don't think that follows. Python's list comprehensions are different -- they
> > pollute the namespace.
> 
> Oh, c'mon. This is a frequently cited yet overstated wart. Yeah,
> technically it's a problem, but much more a theoretical than practical one

It isn't a major problem, but I can remember that it did (infrequently) cause
me bugs, so it's not all theoretical. Another minor cause of annoyance are
things like this:

  SOME_GLOBAL_CONST = [(y**2, x**2) for (x,y) in SOME_OTHER_GLOBAL_CONST]
  del x, y # I could do without this

> - in practice the only time it causes problems is when you're doing
> something questionable anyway, like reusing a variable without
> initializing it to some known value.

Or accidently overwriting a variable (or modulename).

All this might not amount to much, but I do think they violate the spirit of
functional programming enough to bias some people who like FP towards map and
filter.


alex




More information about the Python-list mailing list