Martin Panter <vadmium...@gmail.com> added the comment:

The new “finditer” behaviour seems to contradict the documentation about 
excluding empty matches if they touch the start of another match.

>>> list(re.finditer(r"\b|:+", "a::bc"))
[<re.Match object; span=(0, 0), match=''>, <re.Match object; span=(1, 1), 
match=''>, <re.Match object; span=(1, 3), match='::'>, <re.Match object; 
span=(3, 3), match=''>, <re.Match object; span=(5, 5), match=''>]

An empty match at (1, 1) is included, despite it touching the beginning of the 
match at (1, 3). My best guess is that when an empty match is found, searching 
continues at the same position for the first non-empty match.

----------
nosy: +martin.panter

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue25054>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to