R. David Murray <rdmur...@bitdance.com> added the comment:

Why it works is due to a quirk in the handling of python strings: if an 
apparent escape sequence doesn't "mean anything", it is retained verbatim, 
including the '\' character.  This is documented in 
http://docs.python.org/reference/lexical_analysis.html#string-literals:

"Unlike Standard C, all unrecognized escape sequences are left in the string 
unchanged, i.e., the backslash is left in the string. (This behavior is useful 
when debugging: if an escape sequence is mistyped, the resulting output is more 
easily recognized as broken.)"

It is *very* unwise to depend on this behavior for anything except debugging, 
therefore those examples which do are, in my opinion, wrong.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12162>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to