Author vstinner
Recipients eric.araujo, eric.smith, ezio.melotti, mindauga, mmilkin, mrabarnett, python-dev, rhettinger, terry.reedy, umi, vstinner
Date 2014-10-29.16:09:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:


See my attached re_keyword_only.patch:

* sub(), subn(): count and flags become keyword-only parameters
* split(): maxsplit and flags become keyword-only parameters
Date User Action Args
2014-10-29 16:09:22vstinnersetrecipients: + vstinner, rhettinger, terry.reedy, eric.smith, ezio.melotti, eric.araujo, mrabarnett, python-dev, mindauga, mmilkin, umi
2014-10-29 16:09:21vstinnersetmessageid: <>
2014-10-29 16:09:21vstinnerlinkissue11957 messages
2014-10-29 16:09:21vstinnercreate