[Python-Dev] Raw string syntax inconsistency

Christian Heimes lists at cheimes.de
Sun Jun 17 13:45:22 CEST 2012


Hello,
the topic came up on the python-users list today. The raw string syntax
has a minor inconsistency. The ru"" notation is a syntax error although
we support rb"". Neither rb"" nor ru"" are supported on Python 2.7.
Python 3.3:
 works: r"", ur"", br"", rb""
 syntax error: ru""
Python 2.7:
 works: r"", ur"", br""
 syntax error: ru"", rb""
The ru"" notation isn't necessary for Python 2 compatibility but it's
still an inconsistency. The docs [1] also state that 'r' is a prefix,
not a suffix. On the other hand the lexical definition doesn't mention
the u"" notation yet.
Christian
[1]
http://docs.python.org/py3k/reference/lexical_analysis.html#string-and-bytes-literals


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /