[Python-3000] What to do about "".join([b""])?
Facundo Batista
facundobatista at gmail.com
Fri Nov 2 04:00:43 CET 2007
2007/11/1, Guido van Rossum <guido at python.org>:
> 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
I'd prefer to *always* apply the str() function: simpler, no except
when teaching it, always the same behaviour.
> uniformly apply str(), which for bytes returns a string of the form
> "b'...'" or "buffer(b'...')" (depending on whether the bytes are
Don't understand... From the trunk:
Python 3.0a1+ (py3k:58762, Nov 1 2007, 21:17:44)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> str(b"hola")
'hola'
> immutable or not). Given that we killed the exception for "" == b""
> earlier, I'm tempted to remove the exception. Any opinions to the
> contrary?
+1 to remove the exception
Regards,
--
. Facundo
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
More information about the Python-3000
mailing list