[Python-ideas] Proposal for Ruby-style anonymous block functions (that don't kill the indention)

Jan Kanis jan.kanis at phil.uu.nl
Thu Nov 13 18:53:15 CET 2008


I actually like the idea. Having an @ in a statement turns that
statement grammatically into the start of a block construct. But I
prefer the easier way of allowing lambda x: print x; return x*x kind
of syntax (which may require brackets around the lambda to
disambiguate the semicolons), and that doesn't look like it's going to
make it any time soon.

I also agree with not liking something like myfunc = @(args): ..., but
I don't think the grammar should be complicated with more special
cases than necessary. Leave this to the style guide.

One major technical problem with this is that it would stop the python
grammar from being LL1, and I think Guido wants to keep it like that.
In fact, I'm not quite sure this grammar is still context free (but I
think it still barely is...)

Jan



More information about the Python-ideas mailing list