This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Problem in join function definition
Type: Stage:
Components: Documentation Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: effbot, rhettinger, yseb
Priority: normal Keywords:

Created on 2005-02-11 15:43 by yseb, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg24262 - (view) Author: yseb (yseb) Date: 2005-02-11 15:43
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.


msg24263 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2005-02-12 17:10
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?
msg24264 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-02-12 19:22
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.
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41564
2005-02-11 15:43:00ysebcreate