Small inconsistency between string.split and "".split

Carlos Ribeiro carribeiro at
Tue Sep 14 16:30:14 CEST 2004


On Tue, 14 Sep 2004 12:01:29 +0200, Walter Dörwald
<walter at> wrote:
> Carlos Ribeiro wrote:
> I've fixed the docstring for both unicode.split() and
> string.split() to give a hint about the None default. Note
> that the docstring for str.split() already *did* mention
> the None option.

I don't know if you can do it, but isn't easy to modify the split
method to accept maxsplit as a keyword parameter? It would make it
consistent with string.split(), and as far as I'm aware, it should not
cause any sizeable performance penalty. But the most important reason
is that keyword parameters for often-unused options make code more
readable; for example,


reads better than:

   mystring.,split(None, 2)

That's my opinion, anyway...

Carlos Ribeiro
Consultoria em Projetos
mail: carribeiro at
mail: carribeiro at

More information about the Python-list mailing list