Let's Talk About Lambda Functions!

John Roth johnroth at ameritech.net
Mon Aug 5 14:08:40 CEST 2002


"Greg Ewing" <see_reply_address at something.invalid> wrote in message
news:3D4E006E.9060000 at something.invalid...
> John Roth wrote:
>
> > "Huaiyu Zhu" <huaiyu at gauss.almadan.ibm.com> wrote in message
> > news:slrnakme8c.bn9.huaiyu at gauss.almadan.ibm.com...
> >>    x = y + (
> >>def (z):
> >>    if z: return 'True z'
> >>    else: return 'False z'
> >>        )('arg for anonymous function') + ' & additional expression
> >>
> > terms.'
> >
> > As Bengt points out at more depth, this would be a syntax error,
> > because there is no dedent following the function.
>
>
> When the parser gets to the closing ")", it could do what it
> does at the end of a file, and assume there are enough implied
> dedents to get back to the right level.

Wouddn't that make the parser more complex, however?
The dedent is what closes the structure normally, this would
add a special case rule.

There's a great deal to be said for keeping things simple.
Notice the havoc caused by (,) for null tuples, which is
not simple, especially for novices.

John Roth
>
> --
> Greg Ewing, Computer Science Dept,
> University of Canterbury,
> Christchurch, New Zealand
> http://www.cosc.canterbury.ac.nz/~greg
>





More information about the Python-list mailing list