[docs] backslash ending raw string literals.

Georg Brandl georg at python.org
Sun Oct 6 10:08:47 CEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 26.08.2013 23:59, schrieb Scot Kelly:
> From the doc: http://docs.python.org/2/reference/lexical_analysis.html
> 
> r"\"is not a valid string literal (even a raw string cannot end in an odd 
> number of backslashes). Specifically, //a raw string cannot end in a
> single backslash// (since the backslash would escape the following quote
> character).
> 
> 
> 
> If it?s a raw string, then the backslash will _not_escape the following
> quote character.  Ergo r?\? should be allowed.

Hi Scot,

this is due to a limitation of the Python lexer; the inconsistency is minor
and is accepted as the lesser evil and documented.

cheers,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.21 (GNU/Linux)

iEYEARECAAYFAlJRGo8ACgkQN9GcIYhpnLC6FwCggteSdBwGeqplhx7hwDDOgc5Y
hYAAoJ+BXB9WHg5SQy4joFyWQ0nl06vN
=XSi6
-----END PGP SIGNATURE-----


More information about the docs mailing list