Ezio Melotti <ezio.melo...@gmail.com> added the comment:

The rule 1 makes sense, but it's not entirely obvious (people might consider 
bBaAzZ special too).

The "normal Python rules for backslash escapes but revert to the C behaviour of 
stripping the \ from unrecognised escapes" is not obvious either, and from 
r'[\A]' people might expect:
  1) same as \A, (beginning of the string);
  2) a letter 'A';
  3) a '\' or a letter 'A' (especially if they write it as '[\\A]');

This is why I suggested to raise an error (and refuse the temptation to guess), 
but on the other hand, if you consider 'A' a "normal" letter like 'C', having 
an error for \A would be incoherent.
It would have been better if \C raised an error too (I don't see why that would 
appear in a regex, since re.escape doesn't escape C and the user has no reason 
to add the \), but now it's too late for that.

----------

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

Reply via email to