This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mollison
Recipients docs@python, mollison
Date 2019-04-16.22:42:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1555454579.44.0.38794635257.issue36645@roundup.psfhosted.org>
In-reply-to
Content
This is regarding the change to re.sub() between 3.6 and 3.7 that results in different behavior even for simple cases like the following:

re.sub('a*','b', 'a') returns 'b' in 3.6 and 'bb' in 3.7

This change is well documented here:
https://docs.python.org/3/whatsnew/3.7.html#changes-in-the-python-api

However, it is not well documented here:
https://docs.python.org/3.7/library/re.html

The latter document does actually contain the appropriate text: "Empty matches for the pattern are replaced when adjacent to a previous non-empty match."

However, the formatting makes this text look like it was always there, and is not part of the 3.7 changes announcement.

That is how I interpreted it, leading to some lost productivity.

After so many years, people don't expect the regex engine to change like this, and that only makes it easier to misinterpret that text as always have been there vs. being new to 3.7.

Related:
https://bugs.python.org/issue32308
History
Date User Action Args
2019-04-16 22:42:59mollisonsetrecipients: + mollison, docs@python
2019-04-16 22:42:59mollisonsetmessageid: <1555454579.44.0.38794635257.issue36645@roundup.psfhosted.org>
2019-04-16 22:42:59mollisonlinkissue36645 messages
2019-04-16 22:42:59mollisoncreate