[Python-Dev] Curious comment in some old libraries
Andrew Kuchling
akuchlin@mems-exchange.org
Fri, 9 Feb 2001 15:04:54 -0500
On Fri, Feb 09, 2001 at 03:03:29PM -0500, Eric S. Raymond wrote:
>Pursuant to a conversation Guido and I had in New York, I have gone through
>string.py:# NB: split(s) is NOT the same as splitfields(s, ' ')!
>
>It certainly looks to me as though the "NB" comment is out of date.
>Is there some subtle and wicked reason it has not been removed?
Actually I think it's correct:
>>> import string
>>> string.split('a b c')
['a', 'b', 'c']
>>> string.split('a b c', ' ')
['a', '', 'b', 'c']
With no separator, it splits on runs of whitespace. With an explicit
separator, it splits on *exactly* that separator.
--amk