[Zope] Re: Dynamic script loading

Dieter Maurer dieter@handshake.de
Thu, 10 Apr 2003 19:58:10 +0200


Pawel Lewicki wrote at 2003-4-9 22:59 +0200:
 > > Unless, your code is huge and your resources very
 > > limited, I would not worry at all.
 > 
 > So I'll give it up. :) Is there any difference between loading module at the
 > beginning of the code or inside the function?

Only a small one:

  Imported modules are cached (in "sys.modules").
  Subsequent imports of the same module are therefore quite fast.

  When you put the import at module level, you import only once.


Dieter