Message307424
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. |
|
Date |
User |
Action |
Args |
2017-12-02 10:50:48 | martin.panter | set | recipients:
+ martin.panter, ezio.melotti, mrabarnett, r.david.murray, serhiy.storchaka, Alcolo Alcolo |
2017-12-02 10:50:48 | martin.panter | set | messageid: <1512211848.04.0.213398074469.issue25054@psf.upfronthosting.co.za> |
2017-12-02 10:50:48 | martin.panter | link | issue25054 messages |
2017-12-02 10:50:47 | martin.panter | create | |
|