On Fri, Feb 21, 2020 at 10:19:37PM -0500, David Mertz wrote:
> On Fri, Feb 21, 2020 at 9:26 PM Steven D'Aprano <st...@pearwood.info> wrote:
> 
> > > And what's so special about SQL over, say, regular expressions, XML,
> > > JSON, YAML, Markdown, ReST, LaTeX, etc? I might want to use the s''
> > > prefix for embedded Scheme code rather than SQL.
> >
> > Um, regular expressions are not precisely the best example there, since
> > we do have raw strings specifically for regular expressions.
> >
> 
> I mentioned them also in my similar list, but deliberately.  *Raw strings*
> are not per-se for regexen, even if that is one of the more common uses.

Actually, in Python, regexes are the primary reason raw strings were 
added!

Raw strings aren't quite fully raw, which is why you can't use raw 
strings for Windows paths:

    path = r'somewhere\some\folder\'

doesn't work. The reason is that "raw" (semi-cooked?) strings are 
intended for regexes, not as a general mechanism for disabling string 
escape codes, and regexes aren't allow to end with a bare backslash.


https://docs.python.org/3/faq/design.html#why-can-t-raw-strings-r-strings-end-with-a-backslash


-- 
Steven
_______________________________________________
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/7WU4JKN43NZA52PPTKUMAVS4YWSGOS33/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to