Why ' '.some_string is often used ?

Stéphane Ninin stefnin.nospam at yahoo.fr
Wed Jan 7 07:44:19 EST 2004


  Hi all,

This is not the first time I see this way of coding in Python and 
I wonder why this is coded this way:

Howto on PyXML
(http://pyxml.sourceforge.net/topics/howto/node14.html) 
shows it on this function, but I saw that in many other pieces of code:

def normalize_whitespace(text):
    "Remove redundant whitespace from a string"
    return ' '.join(text.split())

Is there a reason to do instead of just returning join(text.split()) ?
what does this mean ?

Thanks in advance for your explanations.
 
  Regards,

-- 
Stephane Ninin



More information about the Python-list mailing list