S
Stéphane Ninin
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,
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,