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

Yury Selivanov yselivanov.ml at gmail.com
Wed Oct 21 23:35:18 EDT 2015


On 2015-10-21 11:31 PM, Nathaniel Smith wrote:
> I haven't actually gathered any data to find out how strong the
> association between raw strings and regexen is, but it'd be pretty
> easy for someone to do. (Parse a large corpus of python code to
> extract all raw strings, randomly subsample 100 of them, review
> manually to decide if each is a regex.)

I haven't done this in a scientific way you suggest, but
I did glance over the stdlib when I was testing MP.

Most of the raw strings I saw were either docstrings or
regexps.  Docstrings are possible to detect by highlighters,
so MagicPython does not highlight r'' as regexp if it's
a docstring.

Yury


More information about the Python-ideas mailing list