bug in string.join()?

Brian Quinlan BrianQ at ActiveState.com
Sat Feb 24 02:20:11 CET 2001


OK, first of all, according to the docs, string.join operates on tuples and
lists, not strings. If you change your code to string.join(("abcde",)), you
get what you expected.

But string.join will actually except anything sequence-type like and, by
default, insert a space between it's items. Which is exactly what it did.

-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of Fernando Rodríguez
Sent: Friday, February 23, 2001 3:47 PM
To: python-list at python.org
Subject: Re: bug in string.join()?


On Wed, 21 Feb 2001 19:06:13 -0800, Daniel Klein <danielk at aracnet.com>
wrote:

>On Wed, 21 Feb 2001 20:32:11 +0100, Fernando Rodríguez <spamers at must.die>
>wrote:
>
>>>>> string.join(("abcde"))
>>'a b c d e'
>>
>>Is this the expected behavior, or is it a bug? O:-)
>
>What would you expect it to do? It's already 'joined' without spaces to
start
>with.

That's why I expected it to do nothing. Instead, it did something weird.




//-----------------------------------------------
//	Fernando Rodriguez Romero
//
//	frr at mindless dot com
//------------------------------------------------
--
http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list