[Python-ideas] PEP 8: raw strings & regular expressions

Barry Warsaw barry at python.org
Fri Oct 23 14:18:57 EDT 2015


On Oct 22, 2015, at 06:56 PM, Yury Selivanov wrote:

>In principle, there is no reason why *both* of these groups
>of users can't use one tool and be happy.  I propose to
>establish a convention in PEP 8, explaining that, while both
>literals are semantically equivalent,
>
>- r'..' strings *should* be used for regexps,
>
>- R'..' strings *should* be used for unstyled raw strings,
>
>and tools *should* treat them as such.
>
>All of this is merely about codifying the current status quo.

What about all the regexps that are written without raw strings?  Won't PEP 8
codification shame everyone into turn them into raw strings when they really
don't need to?

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151023/75af1dc9/attachment.sig>


More information about the Python-ideas mailing list