[Python-Dev] String interning

Jack Jansen Jack.Jansen@cwi.nl
Mon, 1 Jul 2002 15:19:15 +0200


On Monday, July 1, 2002, at 08:31 , Oren Tirosh wrote:
>   Can anyone
> explain why Mac/Python/macimport.c is messing with ob_sinterned?

It's all explained in the comment a few lines above where ob_sinterned 
is used:
	/*
	** If we have interning find_module takes care of interning all
	** sys.path components. We then keep a record of all sys.path
	** components for which GetFInfo has failed (usually because the
	** component in question is a folder), and we don't try opening these
	** as resource files again.
	*/

This code gives a considerable speedup for module searches. The reason 
it's mac-specific is that MacPython allows files on sys.path as well as 
directories (and these files are searched for PYC resources).
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -