[issue22818] Deprecate splitting on possible zero-width re patterns

Serhiy Storchaka report at bugs.python.org
Sun Jan 18 19:20:38 CET 2015


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 <report at bugs.python.org>
<http://bugs.python.org/issue22818>
_______________________________________


More information about the Python-bugs-list mailing list