[Python-Dev] Re: Advantages of pattern matching - a simple comparative analysis

2020年11月23日 11:37:22 -0800

On 2020年11月23日 16:15:12 -0000
"Brian Coleman" <[email protected]> wrote:
> 
> Furthermore, Python has a regular expression module which implements it's own 
> DSL for the purpose of matching string patterns. Regular expressions, in a 
> similar way to pattern matching,
> allow string patterns to be expressed in a concise and declarative manner.
Uh, without regular expressions, a lot of functions would be massively
more complicated and annoying to write.
However, your example shows that pattern matching barely makes
common code shorter (admittedly, on this _one_ example, but that's the
one you chose ;-)).
While I agree that regular expressions are far less Pythonic than the
proposed variant of pattern matching, they also have a tremendously
better cost/benefit ratio, IMHO.
Regards
Antoine.
_______________________________________________
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/45MP5EZ4D4XIJAQR2WPXLXNMWOMAR3QT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to