[ python-Bugs-1120862 ] Problem in join function definition

SourceForge.net noreply at sourceforge.net
Sat Feb 12 20:22:44 CET 2005


Bugs item #1120862, was opened at 2005-02-11 10:43
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1120862&group_id=5470

Category: Documentation
Group: Python 2.5
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: yseb (yseb)
Assigned to: Nobody/Anonymous (nobody)
Summary: Problem in join function definition

Initial Comment:
There is a problem in the last sentence of the join 
definition. 

==========================================
join( words[, sep]) 

Concatenate a list or tuple of words with intervening 
occurrences of sep. The default value for sep is a single 
space character. It is always true that "string.join
(string.split(s, sep), sep)" equals s. 
==========================================

It is true that string.join(string.split(s, sep), sep)" is 
always equals to s. 

But string.join(string.split(s)) is not always equals to s 
especially for repeated sequence of spaces.




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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2005-02-12 14:22

Message:
Logged In: YES 
user_id=80475

I concur.  The sentence is correct:
>>> s = '  the quick    brown \t\t fox jumped  '
>>> sep = ' '
>>> s == string.join(string.split(s, sep), sep)
True

Possibly the docs could go on to talk about
string.join(string.split(s)).  However that would just be
adding rambling verbiage that is unlikely to be helpful to
anyone who has just read what string.split(s) actually does.

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

Comment By: Fredrik Lundh (effbot)
Date: 2005-02-12 12:10

Message:
Logged In: YES 
user_id=38376

And?  If the documentation explains how something works, 
does it also have to list a couple of other things that doesn't 
work?

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

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


More information about the Python-bugs-list mailing list