Re: I sing the praises of lambda, my friend and savior!

From: Clark C. Evans (cce_at_clarkevans.com)
Date: 10/11/04


Date: Mon, 11 Oct 2004 14:08:05 -0400
To: Jeff Shannon <jeff@ccvcorp.com>

On Mon, Oct 11, 2004 at 10:54:05AM -0700, Jeff Shannon wrote:
| I don't agree. I *still* have to stop and think every time I see a
| lamba -- they parse completely differently in my mind than anything else
| in Python does, and they confuse me every time. Yes, defining a small
| function requires two extra lines... but, y'know, it's not like my
| editor is going to run out of paper. And I find that a well-chosen
| name, even for a single-use thing like this, greatly adds clarity. To
| my mind, calling this func_callback(), or some such descriptive name,
| makes the intent *much* more clear than 'lambda' does.

I beg to differ; and I'm talking about _my_ code, not yours.

| Only when one is already familiar with lambdas. I've gotten to the
| point where I *can* understand them, but it's still a struggle. It
| seems to me that the benefits of having lambda are outweighed by the
| fair amount of extra mental space that they use up. It just strikes me
| as too much of a special case to deserve special syntax that has
| absolutely no parallel elsewhere in Python.

If you don't like lambda -- don't use it. Just beacuse you are
unfamilar with a very helpful construct and are unwilling to learn
does not mean you should prevent others from continuing to enjoy
one of the more pleasant aspects of Python.

Kind Regards,

Clark



Relevant Pages

  • Re: default value in __init__
    ... It has nothing to do with lambda, lambda just happens to be a ...     print cb ... that newbies ask about these semantics doesn't imply that they'd ask ... But that's easy to do with current Python: ...
    (comp.lang.python)
  • Re: I sing the praises of lambda, my friend and savior!
    ... I think that Ruby's code block syntax offers a workable ... How about extending lambda? ... >I actually discovered lambdas in Python first (well, technically Tcl, but I ...
    (comp.lang.python)
  • Re: Python becoming less Lisp-like
    ... think I've seen a lot of whining about lambda and little evidence of ... fundamental wart in Python :-) ... orthogonality: "If you want to do this, then use that, but if you want ... while that use case covered by that special feature, ...
    (comp.lang.lisp)
  • Re: map/filter/reduce/lambda opinions and background unscientific mini-survey
    ... Python language, while "function" etc are not, but they are certainly ... Just as exposure to functional languages would make lambda very familiar. ... > a letter of the greek alphabet. ... There is nothing about the word "string" that especially brings to mind ...
    (comp.lang.python)
  • A friendlier, sugarier lambda -- a proposal for Ruby-like blocks in python
    ... Compared to the Python I know and love, Ruby isn't quite the same. ... To define a new closure and pass it into a function call, ... methods: inline 'def' and 'lambda'. ...
    (comp.lang.python)