[issue43714] re.findall: '\Z' must consume end of string if it matched

Serhiy Storchaka report at bugs.python.org
Sat Apr 10 03:33:07 EDT 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

I concur with Matthew. I tested several implementations in different programming languages. Perl, PHP and Java behave the same way as Python. Sed, awk and Go behave other way. We can argue that one or other way is "better", but it looks subjective, and in any case such change is breaking. It is better to keep the current behavior until we have very good reasons to break things.

Old versions of Python had different behavior, but the implementation contained a bug which caused skipping some characters (see issue25054). It also prevented support of zero-width patterns in re.split() and the behavior was inconsistent between different re functions. The simplest way of fixing that bug lead to behavior consistent with Perl and Java.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43714>
_______________________________________


More information about the Python-bugs-list mailing list