a = b = 1 just syntactic sugar?

Mel Wilson mwilson at the-wire.com
Fri Jun 6 11:08:28 EDT 2003


In article <l1r867k8p8.fsf at budvar.future-i.net>,
Ed Avis <ed at membled.com> wrote:
>"Terry Reedy" <tjreedy at udel.edu> writes:
>Why then not allow the same things inside lambda as inside def?  At
>least as far as keeping the function body on a single line.
>
>>Extending lambda to embed even simple statements within expressions
>>is problematical:
>
>    lambda x: assert(x > 0)

There's a wrinkle in this one:

>    lambda x: print 'value:', x

    j = map (lambda x: print 'value:', x, some_list)

   What is the print statement supposed to print?  And since
print doesn't return anything (not even None), what happens
to j?

        Regards.        Mel.




More information about the Python-list mailing list