[Python-Dev] Curious comment in some old libraries
Fred L. Drake, Jr.
fdrake@acm.org
Fri, 9 Feb 2001 15:03:13 -0500 (EST)
Eric S. Raymond writes:
> string.py:# NB: split(s) is NOT the same as splitfields(s, ' ')!
> string.py: (split and splitfields are synonymous)
> string.py:splitfields = split
>
> 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?
The comment is correct. splitfields(s) is synonymous with split(s),
and splitfields(s, ' ') is synonymous with split(s, ' ').
If the second arg is omitted, any stretch of whitespace is used as
the separator, but if ' ' is supplied, exactly one space is used to
split fields.
split(s, None) is synonymous with split(s), splitfields(s), and
splitfields(s, None).
-Fred
--
Fred L. Drake, Jr. <fdrake at acm.org>
PythonLabs at Digital Creations