Message152384
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. |
|
Date |
User |
Action |
Args |
2012-01-31 13:13:10 | ezio.melotti | set | recipients:
+ ezio.melotti, georg.brandl, sjmachin, mrabarnett, docs@python |
2012-01-31 13:13:10 | ezio.melotti | set | messageid: <1328015590.57.0.567266081962.issue13899@psf.upfronthosting.co.za> |
2012-01-31 13:13:10 | ezio.melotti | link | issue13899 messages |
2012-01-31 13:13:09 | ezio.melotti | create | |
|