n = lambda x: print x

Justin Sheehy dworkin at ccs.neu.edu
Thu May 4 16:31:29 CEST 2000


"Warren Postma" <embed at geocities.com> writes:

> The question I wondered was, if Python accepted this:
> 
> n = lambda x: print x
> 
> What would it do with this:
> 
> n = (lambda x: print x,y)

It's a moot point, as neither one is valid.

> Is the first construct specifically disallowed in the python grammar
> somehow?

Yes, lambda can only contain an expression.  A statement will not do.

-Justin

 




More information about the Python-list mailing list