Tim Peters added the comment:
>> (?<=a)(?<=a)(?<=a)(?<=a)
> There are four different points.
> If a1 before a2 and a2 before a3 and a3 before a4 and a4
> before something.
Sorry, that view doesn't make any sense. A successful lookbehind assertion
matches the empty string. Same as the regexp
()()()()
matches 4 empty strings (and all the _same_ empty string) at any point.
> Otherwise repetition of assertion has no sense.
As I said before, it's "usually a silly thing to do". It does make sense, just
not _useful_ sense - it's "silly" ;-)
> If it has no sense, there should be an exception.
Why? Code like
i += 0
is usually pointless too, but it's not up to a programming language to force
you to code only useful things.
It's easy to write to write regexps that are pointless. For example, the regexp
(?=a)b
can never succeed. Should that raise an exception? Or should the regexp
(?=a)a
raise an exception because the (?=a) part is redundant? Etc.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue14460>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com