Tushar Sadhwani writes:

 > Since Python has built-in syntax for interpolated strings, I
 > believe it's a good area to idea to extend it to pattern matching,
 > like so:
 > 
 >     def unquote(string: str) -> str:
 >         match string:
 >             case f'"{value}"':
 >                 return value
 >             case f"'{value}'":
 >                 return value
 >             case _:
 >                 return string

I think this is a pretty unconvincing example.  While people seem to
love to hate on regular expressions, it's hard to see how that beats

    def unquote(string: str) -> str:
        m = re.match(r"^(?:\"(.*)\"|'(.*)'|(?Pvalue3))$", string)

 > 
 > Doing this with current match syntax is not as easy.
 > 
 > I have other reasons to consider this idea as well, but before I try to 
 > pursue this, I'd like to know if something like this was already discussed 
 > when the proposal was being made?
 > _______________________________________________
 > Python-ideas mailing list -- python-ideas@python.org
 > To unsubscribe send an email to python-ideas-le...@python.org
 > https://mail.python.org/mailman3/lists/python-ideas.python.org/
 > Message archived at 
 > https://mail.python.org/archives/list/python-ideas@python.org/message/4D2CRUSACUYK2VNYHULBUQ525QAF7XDV/
 > Code of Conduct: http://python.org/psf/codeofconduct/
 > 
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/PCHVUOR6MZYWSAVYUVZ4E3ZCEH73AFZF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to