indirect import of standard module

Ben Finney bignose+hates-spam at benfinney.id.au
Tue Apr 18 18:48:36 EDT 2006


"alisonken1" <alisonken1 at gmail.com> writes:

> Unless you override some of os.* functions in foo, you want to
> import os into foo and bar separately.
> 
> Python does not reimport the module a second time (create a second
> instance of os)

More accurately, it *does* import it twice, into two separate
namespaces; but loads and executes the code only the first time.

-- 
 \      "God forbid that any book should be banned. The practice is as |
  `\               indefensible as infanticide."  -- Dame Rebecca West |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list