On Jan 9, 2013 5:40 AM, "Sylvain Thénault" <sylvain.thena...@logilab.fr> wrote: > > On 08 janvier 13:13, Martin Pool wrote: > > Hi, > > Hi Martin, > > > Following on from my patch to fix an incorrect warning for \0, this one > > adds a new warning for octal character escapes in a string. A typical > > problematic example is: > > > > re.sub('\w+,\w+', '\1 \2', a) > > > > and a bit more motivation is that > > pep-3127<http://www.python.org/dev/peps/pep-3127/> deprecates > > the 0-prefixed syntax for integers (not for character escapes.) > > > > Of course this is more of a warning about something that might be > > unintentional, and people might reasonably choose to use them, for > > something like '\033' (escape). But, it's easy to turn it off or rephrase > > that as '\x1b'. > > I tend to agree, though may be it deserves a separated warning so it > may be disabled globally. May be some other people on the list have an opinion > on this ?
Hi, After thinking about this note and considering the feedback, I'm not so sure this will prevent enough problems to be worth the trouble to people who do intend to use octal. Perhaps we could look for octal escapes in the second arg to re.sub, or in docstrings. But it's not an especially pressing problem for me, more just something that fell out of fixing up \0. -m
_______________________________________________ Python-Projects mailing list Python-Projects@lists.logilab.org http://lists.logilab.org/mailman/listinfo/python-projects