Depricated String Functions in Python
Duncan Booth
duncan.booth at invalid.invalid
Fri Jul 21 03:41:42 EDT 2006
Sybren Stuvel wrote:
> Donn Cave enlightened us with:
>> Oh, excellent - the string module is dead, long live the string
>> module! I can replace string.join with str.join, and never have to
>> defile my code with that ' '.join(x) abomination.
>
> It's not an abomination. It's a very clear way of telling those two
> apart:
>
> ' '.join(x)
> u' '.join(x)
I don't understand that comment. Are you saying that str.join vs
unicode.join isn't a clear distinction?
I like using str.join/unicode.join myself, but one advantage of using
separator.join directly is that you can save the bound method:
joinlines = '\n'.join
joinwords = ' '.join
you can't do that by calling the method on the type.
More information about the Python-list
mailing list