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

Beni Cherniavsky cben at techunix.technion.ac.il
Mon Mar 3 09:15:23 EST 2003


On 2003-03-03, Stephen Horne wrote:

> On 02 Mar 2003 23:16:53 +0000, Alexander Schmolck <a.schmolck at gmx.net>
> wrote:
>
> >Stephen Horne <intentionally at blank.co.uk> writes:
> >
> >> Actually, I've always thought that having separate 'def' and 'lambda'
> >> syntaxes is a bit redundant. In lisp (and a few others) you'd use the
> >> 'lambda' form to do both jobs, rather like (in current Python)
> >> writing...
> >>
> >>   sum = lambda a, b : a + b
> >
> >Not true, I think. Apart from scheme (which's lispness is often disputed in
> >both lisp and scheme circles).
>
> Wierd - I've hardly used scheme, but I have looked at it much more
> recently than lisp (not used properly in more than a decade). Still, I
> appologise for the confusion.
>
At the bottom level, the equivalence holds in all lispy languages
(there is the minor issue of the function's __name__, defun is
actually equivallent to some named-lambda construct ...).

In actual use, you use lambda only when you don't need to give it a
name; when you do, you always use the defun/define syntax sugar.  I
happen to prefer Scheme's version here (in Python terms, that would be
roughly ``sum(a, b) = a + b``) but that's not important.

Internally the scheme/lisp cultures like to distinguish each from the
other but when you want to refer to both collectively, you invariable
call it the Lisp family of languages.  It's rarely disputed that
Scheme is one of the more elegant members of this family, compared to
CL (but frequently its practicallity is disputed ;-).

-- 
Beni Cherniavsky <cben at tx.technion.ac.il>

pure virtual static warp shield (TNG++, All Good Things O-=)






More information about the Python-list mailing list