[ python-Bugs-1380970 ] split() description not fully accurate

SourceForge.net noreply at sourceforge.net
Thu Dec 15 06:15:21 CET 2005


Bugs item #1380970, was opened at 2005-12-14 18:33
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1380970&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: K.C. (kace)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: split() description not fully accurate

Initial Comment:
The page http://docs.python.org/lib/string-methods.html
reads, in part, "If sep is not specified or is None, a
different splitting algorithm is applied. First,
whitespace characters (spaces, tabs, newlines, returns,
and formfeeds) are stripped from both ends."  However,
this is not the behaviour that I'm seeing.  (Although,
I should note that I'd find the described behaviour
more desirable.)  Example,

>>> trow = '1586\tsome-int-name\tNODES: 111_222\n'
>>> print trow
1234    some-int-name   NODES: 111_222

>>> trow.split(None,2)
['1234', 'some-int-name', 'NODES: 111_222\n']
# end example.

Notice that the trailing newline has not been stripped
as the documentation said it should be.  Thanks all.

K.C.



----------------------------------------------------------------------

Comment By: K.C. (kace)
Date: 2005-12-14 18:36

Message:
Logged In: YES 
user_id=741142

Also, (oops) the example comes from the most recent version:

$ python
Python 2.4.2 (#2, Oct  4 2005, 13:57:10) 
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
Type "help", "copyright", "credits" or "license" for more
information.
>>> 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1380970&group_id=5470


More information about the Python-bugs-list mailing list