[Python-Dev] Re: string .join() vs. Unicode .join()

M.-A. Lemburg mal@lemburg.com
Thu, 20 Sep 2001 18:44:47 +0200


Guido van Rossum wrote:
> 
> Today, test_string and test_unicode have started to fail.  I'm
> suspicious that this is the result of changes Marc-Andre checked in to
> make unicode() behave more like str().
> 
> A little investigation (not that the string test suite makes this easy
> :-( ) shows that line 133 of string_tests.py checks to make sure that
> 
>     '.'.join('a', u'b', 3)
> 
> raise an exception.  But it now silently casts the 3 to u'3', so the
> result is u'a.b.3'.

Some more investigation showed that Unicode .join() does an 
implicit unicode() on all objects in the list whereas the
string .join() does not.

I think that this is a bug in the Unicode .join() method (the
string .join() method can only handle strings and Unicode
objects). Should I change the Unicode .join() method to match
the semantics of string.join() ?!

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Consulting & Company:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/