[Python-Dev] Re: [Python-checkins] python/dist/src/Lib/test test_string.py, 1.25, 1.26

Greg Ewing greg at cosc.canterbury.ac.nz
Fri Aug 27 03:32:44 CEST 2004


Tim Peters <tim.peters at gmail.com>:

> > u = u"foo"
> > assert u"".join([s]) is s
> 
> Well, in that example it *has* to fail, because the input (s) wasn't a
> unicode string to begin with, but u"".join() must return a unicode
> string.

It could be argued that joining a single-element list doesn't
involve using the separator at all, so its type shouldn't matter.

It could also be argued that joining with an empty string, of
whatever flavour, is equivalent to just concatenating the list
elements with no separator, so again the type of the separator
shouldn't matter.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+


More information about the Python-Dev mailing list