[Python-3000] What to do about "".join([b""])?

Guido van Rossum guido at python.org
Fri Nov 2 03:21:11 CET 2007

Currently (in 3.0), "".join(<seq>) automatically applies str() to the
items of <seq>, *except* if the item is a bytes instance -- then it
raises a TypeError. Is that proper behavior? The alternative is to
uniformly apply str(), which for bytes returns a string of the form
"b'...'" or "buffer(b'...')" (depending on whether the bytes are
immutable or not). Given that we killed the exception for "" == b""
earlier, I'm tempted to remove the exception. Any opinions to the

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-3000 mailing list