escape sequences and string comparisons
jkndeja at my-deja.com
jkndeja at my-deja.com
Tue Jan 9 07:57:18 EST 2001
OK, answering my own question: The Online Python documentation says
(re. String literals, _my emphasis_):
"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.) "
To which I reply:
- Serves me right for not RTFM ... ;-/
- not sure that I'm convinced by the debugging argument
- I still think this makes re.escape() less useful than it
might be. How about a function which turns a string into an 'escaped'
form such that it would be an 'exact' RE match with itself?
I'll go and lie down now. Thanks for listening ;-)
jon N
Sent via Deja.com
http://www.deja.com/
More information about the Python-list
mailing list