Let's Talk About Lambda Functions!

Huaiyu Zhu huaiyu at gauss.almadan.ibm.com
Fri Aug 2 21:59:40 EDT 2002


Bengt Richter <bokr at oz.net> wrote:
>Just leave out the name after the def to make it anonymous,
>and use parens to make the scope of the def expression obvious, e.g.,
>
>    x = y + (
>        def (z):
>            if z: return 'True z'
>            else: return 'False z'
>        )('arg for anonymous function') + ' & additional expression terms.'
>

One problem of allowing intervening parens to adjust indentation is that the
following is also a possibility

    x = y + (
def (z):
    if z: return 'True z'
    else: return 'False z'
        )('arg for anonymous function') + ' & additional expression terms.'

I think it's better to ban this by completely ignore intervening parens as
far as indentation is concerned.

Huaiyu




More information about the Python-list mailing list