[Python-Dev] Deprecating obsolete builtins

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Wed Nov 5 23:31:03 EST 2003


> From: Neal Norwitz [mailto:neal at metaslash.com]
> 
> For the most part, I meant to remove them (including intern)
> altogether in the long run.  In 2.4, I only meant to officially
> deprecate them with a warning.  intern() doesn't seem particularly
> useful or commonly used.  At least moving it to sys or some other
> module is an improvement IMO.

One reason why intern() hasn't been commonly used is that it made things immortal. This is no longer the case - I'd like to see if the use of intern() changes.

What I would prefer would be for intern() to be able to take any hashable object - in particular, tuples. It's not uncommon for me to create lots of small tuples which end up having the same data in them - interning could save quite a bit of memory.

Yes, I can fake it with my own interning function, but that then means I have to deal with the immortality problems again.

So I'd actually advocate enhancing intern(), rather than removing it, now that interned things are mortal.

Tim Delaney



More information about the Python-Dev mailing list