This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sergioc
Recipients sergioc
Date 2007-09-18.16:59:52
SpamBayes Score 0.2368293
Marked as misclassified No
Message-id <1190134792.72.0.164099608894.issue1176@psf.upfronthosting.co.za>
In-reply-to
Content
str.split() does not accept maxsplits as a keyword argument.

If i want to split a string, and, say, get its first word, I do this:

>>> 'SPAM eggs eggs spam spam ham'.split(None, 1)[0]
'SPAM'

However, as documented on help(str.split), the separator is optional, so
 I expected this to work:

>>> 'SPAM eggs eggs spam spam ham'.split(maxsplit=1)

Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    'SPAM eggs eggs spam spam ham'.split(maxsplit=1)
TypeError: split() takes no keyword arguments

I feel allowing keyword arguments is convenient, but is there a reason
behind not allowing them?
History
Date User Action Args
2007-09-18 16:59:53sergiocsetspambayes_score: 0.236829 -> 0.2368293
recipients: + sergioc
2007-09-18 16:59:52sergiocsetspambayes_score: 0.236829 -> 0.236829
messageid: <1190134792.72.0.164099608894.issue1176@psf.upfronthosting.co.za>
2007-09-18 16:59:52sergioclinkissue1176 messages
2007-09-18 16:59:52sergioccreate