On 5 Sep 2020 Ram Rachum <[email protected]> wrote:
>
> Hi everyone,
>
> Sorry if this was proposed already. I looked here
> https://www.python.org/dev/peps/pep-0622/#alternatives-for-constant-value-pattern,
> search for "idea to make lookup semantics the default". I saw that a few
> symbols like $ and ? were proposed, and I thought that maybe the annotation
> syntax -> could indicate a capture expression, like so:
>
> case x:
> match Point(-> a, -> b):
> ...
> match -> whatever:
> do_something(whatever)
>
> I like the arrow because it's easy to imagine the value "entering" the
> variable. What do you think?
>
>
> Thanks,
> Ram.
Nice! :)
Combined with keywords that could become:
Point(x -> a, y -> b)
or, mixed with providing values:
Point(x -> a, y=42)
And we wouldn’t need
match -> whatever:
because we already have x, and if x is an expression I’d prefer
case x as whatever:
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/AFTPEB5R2JMGVLIOOYDCGMMX2QNSTAWJ/
Code of Conduct: http://python.org/psf/codeofconduct/