Internals of interning strings

Jason Stokes jstok at bluedog.apana.org.au
Sun Mar 26 08:41:46 EST 2000


Michael Hudson wrote in message ...
>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.


But those are *different* string objects.  The optimization we're discussing
affects only *the same* string object being interned several times.





More information about the Python-list mailing list