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

Benjamin Peterson benjamin at python.org
Fri Sep 20 15:57:26 CEST 2013


2013/9/20 Jesus Cea <jcea at jcea.es>:

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

On 20/09/13 15:44, Antoine Pitrou wrote:

Yes. The main difference is that sys.intern() will remove the interned strings when every external reference vanishes. It requires either weakref'ability (which both str and bytes lack) or special cooperation from the object destructor (which is why sys.intern() is restricted to str instead of working with arbitrary objects). Great comment. Thanks. Why str/bytes doesn't support weakrefs, beside memory use?

Is increased memory use for every str/bytes object not a good enough reason?

-- Regards, Benjamin



More information about the Python-Dev mailing list