Brett Cannon added the comment: 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. ---------- nosy: +brett.cannon __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1123> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com