when to use intern()

Gregory Trubetskoy grisha at ispol.com
Thu Apr 27 08:25:06 EDT 2000


It says in the manual that some things in Python get interned
automatically. I'm not sure where intern() is necessary - 

if I have a statement like:

if self.config.has_key("PythonOption"):
   ...

that gets executed a lot - should I consider interning "PythonOption" or
is it done automatically?

what about

PYTHON_OPTION = "PythonOption"
if self.config.has_key(PYTHON_OPTION):
   ...

is this interned?


Thanks!


--
  Gregory (Grisha) Trubetskoy
       grisha at ispol.com




More information about the Python-list mailing list