➜

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.

作者 tim.peters
收信人 BreamoreBoy, ezio.melotti, mrabarnett, py.user, serhiy.storchaka, tim.peters
日期 2014-06-26.23:42:32
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1403826152.25.0.930128809913.issue14460@psf.upfronthosting.co.za>
In-reply-to
内容
BTW, note that the idea "successful lookaround assertions match an empty string" isn't just a figure of speech:  it's the literal truth, and - indeed - is key to understanding what happens here.  You can see this by adding some capturing groups around the assertions.  Like so:

m = re.search("((?<=a))((?<=a))((?<=a))((?<=a))b", "xab")

Then

[m.span(i) for i in range(1, 5)]

produces

[(2, 2), (2, 2), (2, 2), (2, 2)]

That is, each assertion matched (the same) empty string immediately preceding "b" in the target string.

This makes perfect sense - although it may not be useful.  So I think this report should be closed with "so if it bothers you, don't do it" ;-)
历史
日期 用户 动作 参数
2014-06-26 23:42:32tim.peters修改recipients: + tim.peters, ezio.melotti, mrabarnett, py.user, BreamoreBoy, serhiy.storchaka
2014-06-26 23:42:32tim.peters修改messageid: <1403826152.25.0.930128809913.issue14460@psf.upfronthosting.co.za>
2014-06-26 23:42:32tim.peters链接issue14460 messages
2014-06-26 23:42:32tim.peters创建