Serhiy Storchaka added the comment:

Because users expect that split() supports zero-width patterns (as sub() 
supports them) and regexps in other languages support splitting on zero-width 
patterns. This looks as accidental implementation detail (see my patch in 
issue22817 -- the difference is pretty small) frozen in the ages for backward 
compatibility. We can't change this behavior in maintained releases because 
this will break mach code which accidentally use zero-width patterns. But we 
can change it in future as new feature, after deprecating current behavior. 
This would be very useful feature. For example it would allow to simplify and 
speed up the regex used for splitting on hyphens in textwrap (something like 
r'(?<=\w-)(?=\w)').

----------

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

Reply via email to