[Python-Dev] Re: PEP 642 v3: Explicit patterns for structured pattern matching

2021年1月09日 07:09:00 -0800

On 2021年1月10日, 12:54 am Nick Coghlan, <[email protected]> wrote:
>
>
> On 2021年1月10日, 12:22 am Paul Moore, <[email protected]> wrote:
>
>> On Sat, 9 Jan 2021 at 13:53, Antoine Pitrou <[email protected]> wrote:
>>
>>
>> The dictionary destructuring can act as an example. We know Nick's
>> position:
>>
>> case {"text": message, "color": c}:
>>
>> 1. There's nothing (other than the fact that it's in a case clause) to
>> indicate that message and c are assigned to.
>> 2. It "binds to the right without using as", (as far as I can see,
>> based on the premise that "as" is the only valid way of binding names
>> where the name is on the right, which was asserted without any
>> justification).
>>
>
> What other syntax do we have that binds to the right without "as"?
> Allowing it at all is only as old as with statements, but that's still more
> precedence than ":" and "=" have for being used that way.
>
Correcting myself: the import statement usage has been around much longer
than that.
With statements were just the case that took 'as name' from being an import
specific syntax to being a bit more general than that.
Cheers,
Nick.
>>
_______________________________________________
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/CSW5HIN3WBEXYECBFZ7ZRH4KLXODLZTD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to