[Python-Dev] Deprecating obsolete builtins

Aahz aahz at pythoncraft.com
Wed Nov 5 23:55:45 EST 2003


On Thu, Nov 06, 2003, Delaney, Timothy C (Timothy) wrote:
> 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.

Agreed.  But intern() should *not* be a builtin function.  It belongs in
sys.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"It is easier to optimize correct code than to correct optimized code."
--Bill Harlan



More information about the Python-Dev mailing list