Terry J. Reedy <tjre...@udel.edu> added the comment:

The two methods are defined differently, and act as defined, so this is a 
feature request, not a bug report.

str.split([sep[, maxsplit]]) 
... If maxsplit is given, at most maxsplit splits are done (thus, the list will 
have at most maxsplit+1 elements). If maxsplit is not specified, then there is 
no limit on the number of splits (all possible splits are made).

re.split(pattern, string, maxsplit=0, flags=0)
...If maxsplit is nonzero, at most maxsplit splits occur,

Clearly, if maxsplit for re.split is the default of 0, it must do all splits. 
There is a difference between being optional with no default (possible with 
C-coded functions) and with a default.

Logically, both should have a default of None, meaning no limit. But I agree 
with Ezio and do not see that happening for Python 3.

As for negative values, I would have maxsplit treated as a count and make 
negative values a ValueError.

----------
nosy: +terry.reedy
status: open -> closed
type: behavior -> feature request
versions:  -Python 2.7, Python 3.2

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

Reply via email to