STINNER Victor added the comment: I suggest to make the 2 last parameters of re.sub(), re.subn() and re.split() parameters as keyword-only. It will break applications using count and maxsplit parameters as index parameters, but it's easy to fix these applications if they want to support also Python 3.5.
I checked Python 2.6: the name of the maxsplit and count parameters didn't change. So it's possible to write code working on Python 2.6-3.5 if the parameter name is explicitly used: * re.sub("a", "a", "a", count=1) * re.subn("a", "a", "a", count=1) * re.split("a", "a", maxsplit=1) The flags parameter was added to re.sub(), re.subn() and re.split() functions in Python 2.7: * https://docs.python.org/2.7/library/re.html#re.sub * https://docs.python.org/2.7/library/re.html#re.subn * https://docs.python.org/2.7/library/re.html#re.split See my attached re_keyword_only.patch: * sub(), subn(): count and flags become keyword-only parameters * split(): maxsplit and flags become keyword-only parameters ---------- keywords: +patch nosy: +haypo Added file: http://bugs.python.org/file37067/re_keyword_only.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11957> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com