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 brett.cannon
Recipients brett.cannon, effbot, fdrake, jafo, nirs
Date 2007-09-19.02:22:38
SpamBayes Score 0.0021923443
Marked as misclassified No
Message-id <1190168559.73.0.873935488914.issue1123@psf.upfronthosting.co.za>
In-reply-to
Content
The algorithm is actually kind of odd::

  >>> " a b".split(None, 0)
  ['a b']
  >>> "a b ".split(None, 0)
  ['a b ']
  >>> "a b ".split(None, 1)
  ['a', 'b ']

So trailing whitespace on the original string is stripped only if the
number of splits is great enough to lead to a possible split past the
last element.  But leading whitespace is always removed.

Basically the algorithm stops looking for whitespace once it has
encountered maxsplit instances of contiguous whitespace plus leading
whitespace.
History
Date User Action Args
2007-09-19 02:22:40brett.cannonsetspambayes_score: 0.00219234 -> 0.0021923443
recipients: + brett.cannon, fdrake, effbot, jafo, nirs
2007-09-19 02:22:39brett.cannonsetspambayes_score: 0.00219234 -> 0.00219234
messageid: <1190168559.73.0.873935488914.issue1123@psf.upfronthosting.co.za>
2007-09-19 02:22:39brett.cannonlinkissue1123 messages
2007-09-19 02:22:38brett.cannoncreate