Internals of interning strings

Michael Hudson mwh21 at cam.ac.uk
Sun Mar 26 08:37:09 EST 2000


Bernhard Herzog <herzog at online.de> writes:

> That's something I've also wondered about. How likely is it that one and
> the same string object will be interned several times? That seems to be
> the only thing that's really optimized.

If you have this in one module:

import sys,os

and in another

import sys,string

then the string "sys" will get interned twice during compilation.  So
to answer your question, pretty likely.

Cheers,
M.

-- 
well, take it from an old hand: the only reason it would be easier
to program in C is that you can't easily express complex  problems
in C, so you don't.                 -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list