[Python-Dev] sys.intern should work on bytes (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Fri Sep 20 14:15:51 CEST 2013


Le Fri, 20 Sep 2013 13:19:24 +0200, Jesus Cea <jcea at jcea.es> a écrit :

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

""" sys.intern(b'12121212') Traceback (most recent call last): File "", line 1, in TypeError: must be str, not bytes """ I wonder why.

From http://docs.python.org/3.3/library/sys.html#sys.intern

"""sys.intern(string)

Enter string in the table of “interned” strings and return the
interned string [...]"""

In Python 3 context, "string" means "str".

Regards

Antoine.



More information about the Python-Dev mailing list