Is this a good use for lambda

Simo Melenius firstname.lastname at iki.fi-spam
Mon Dec 20 11:17:17 CET 2004


"Fredrik Lundh" <fredrik at pythonware.com> writes:

> Simo Melenius wrote:
> > Sure, but mental pollution counts too IMO. What you write and what you
> > read must go through your brain, including dummy variables. And next
> > you start thinking how to "hide" it from your own mind (e.g. naming it
> > "_my_local_func" or something as ugly as the leading underscores in
> > it).
> use something short, like "f".  hopefully, a single character won't overload
> your brain.

I've heard some brain can tackle even Java's overly verbose syntax, it
just depends on one's mind set how the verbosity is perceived: some
find it a disrupting must, some like spending time writing things for
which another programmer would've written a code generator by now.

Elaborating more: Yes, naming functions that are only used once is
minor nuisance (but still something I hope to get rid of eventually).
In a level, it's probably similar to how whitespace at the end of the
lines bogs some people -- that stuff just doesn't need to be there, so
the text feels cluttered. (For _that_, Emacs luckily has its
whitespace mode.. :))

***

Like someone pointed, using _ is a good convention for throwaways. The
fact that such a convention exist just emphasizes that it _is_ an
issue from which people try to sway away.

> > And I think that it does, in fact, touch the innermost symbol table
> yes, but the overhead of keeping a local slot updated is very small,

Sure; though I considered it more of a conceptual issue rather than a
performance one.


br,
S



More information about the Python-list mailing list