[Python-ideas] pep 312 - implicit lambdas idea
Masklinn
masklinn at masklinn.net
Fri Aug 7 15:20:19 CEST 2009
On 7 Aug 2009, at 15:08 , ilya wrote:
> I'd like to use this syntax only in situations of PEP 312, that is,
> where a colon is prohibited by current grammar. In those situations,
> writing _: is also prohibited by current grammar so it will be parsed
> unambiguously.
>
> The examples you quoted will not change under my idea, but ``x =
> (_:_*2)`` would be possible as an alternative. Note that I would be
> against being able to use ``x = _:_*2``. I think it's better to
> require either lambda keyword or parentheses for the RHS of the
> assignment as colon has a well-defined meaning as starting an indented
> block unless it's inside some brackets.
It's not much of a gain though, some kind of currying for operators
might be a more general idea for those cases. Or simply a better
lambda syntax (Haskell has a pretty cool one for what it's worth, but
it might conflict with the EOL escape thing), but as far as I know
previous discussions on the subject have either failed to come up with
a viable syntax or failed to get the approval of the community or BDFL.
More information about the Python-ideas
mailing list