Different behaviour of regexp in 3.6.0b2

Ned Batchelder ned at nedbatchelder.com
Fri Oct 14 13:12:43 EDT 2016


On Friday, October 14, 2016 at 1:00:12 PM UTC-4, Chris Angelico wrote:
> On Sat, Oct 15, 2016 at 3:45 AM, Lele Gaifax <lele at metapensiero.it> wrote:
> > Chris Angelico <rosuav at gmail.com> writes:
> >
> >> There's a shift as of 3.6 to make unrecognized alphabetic escapes into
> >> errors, or at least warnings.
> >
> > But we are talking about raw strings here, specifically r'\s+'.
> >
> > I agree that with plain strings it's a plus.
> 
> Right; the main change is for non-raw string literals, but it looks
> like the same change was made to regular expressions at the same time.
> IMO that's a good thing - the rule is simply "starting with 3.6, you
> should avoid \Z for any upper- or lower-case Z that doesn't have a
> documented meaning".

There doesn't seem to be a change to string literals at all. It's only a
change in the regex engine.

    Python 3.6.0b2 (default, Oct 10 2016, 21:30:05)
    [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> "\s"
    '\\s'

--Ned.



More information about the Python-list mailing list