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

2021年1月11日 06:19:21 -0800

On 2021年1月10日, 7:37 pm Paul Sokolovsky, <[email protected]> wrote:
> And I patiently continue this thread, hoping that people whose argument
> would be along the lines of "I teach Python, and I don't want to teach
> my students 2 ways of doing the same thing, and which way use when. Why,
> if PEP634 offers just one way?"
>
They don't do the same thing, though. One does traditional duck typing
(checking for the presence of a specified set of attributes on an object),
while the other matches a sequence of attributes specified by the class.
PEP 634 just conflates the two tasks into a single call-like syntax that
may or may not bare any resemblance to the type's constructor signature.
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/2XYLWGHUSDADOUWDDHPLL2NNMJZM4VO2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to