On 25/06/20 3:31 am, Taine Zhao wrote:
https://thautwarm.github.io/Site-32/Design/PEP622-1.html

In your AND pattern example, you seem to envisage there being a Urlopen
class whose __match__ method has the side effect of opening the URL.

This makes it much more than just a pattern to be matched, as it's
also doing some of the work of your program. I would say this goes
against the spirit of what the PEP proposes, which is that patterns
should just be passive declarations of things to look for and should
not have side effects.

That's not to say there are no uses for deconstructing the same
object more than one way, but your case would be more persuasive if
you could come up with a side-effect-free example.

--
Greg
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/MGYMDAM5OB4VXDTOVNNDERVMC5XK6JME/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to