[Python-3000] What to do about "".join([b""])?
Brett Cannon
brett at python.org
Fri Nov 2 06:26:20 CET 2007
On 11/1/07, Guido van Rossum <guido at python.org> wrote:
> 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
> contrary?
I say all or nothing; uniformly apply str and duck typing or only
accept str objects. For transition reasons the latter would probably
work out nicer than the former. But for purity I prefer applying
str().
-Brett
More information about the Python-3000
mailing list