a = b = 1 just syntactic sugar?

Terry Reedy tjreedy at udel.edu
Sun Jun 8 03:07:31 CEST 2003

"Ed Avis" <ed at membled.com> wrote in message
news:l1r865h7vk.fsf at budvar.future-i.net...
>  I am just asking, why is
> it that the body of an anonymous function cannot contain statements?

Since you have rejected my and others explanation, I will stop.

> The fact that the expression / statement distinction exists is not
> itself a reason to prohibit statements from appearing in anonymous
> functions.

You have yet to demonstrate that it is sensibly possible to do so.

> Do you think that prohibiting statements inside lamda bodies follows
> the principle of least surprise?

For me it does, for you not.

> I didn't argue for general substitutivity or for abolishing the
> statement/expression distinction, only for allowing statements
> lambda-functions, as they can appear inside named functions.  But I
> accept that multi-line lambda definitions would be too awkward.

Good that we agree on this part.

> It seems to me from the Python grammar that the production
> is a statement that fits on one line.

You clipped and did not answer my question as to what you mean by

> advocating any of that.  Just one small and seemingly simple change,
> to let a single line of code be used as the body of an anonymous
> function rather than only expressions as at present.

You clipped and did not answer my question about multiple lambdas on
one line.  Until you clarify your proposal, I cannot discuss it more.

Terry J. Reedy

More information about the Python-list mailing list