indirect import of standard module

Ben Finney bignose+hates-spam at benfinney.id.au
Tue Apr 18 20:10:43 EDT 2006


"BartlebyScrivener" <rpdooling at gmail.com> writes:

> >> More accurately, it *does* import it twice, into two separate
> >> namespaces;
> 
> If it's in two different namespaces, how can they have the same id
> number?

That "two different namespaces" might be a bit inaccurate.

There is only one object representing the module, which is created the
first time it is imported. That object has a unique id.

There can be any number of names referring to that module object, in
different parts of the namespace.

-- 
 \        "I used to work in a fire hydrant factory. You couldn't park |
  `\                       anywhere near the place."  -- Steven Wright |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list