[Tutor] proper import syntax

Andrei Kulakov ak@silmarill.org
Sat, 08 Sep 2001 15:22:42 -0400


On Sat, Sep 08, 2001 at 02:14:00PM -0400, David L. Lerner wrote:
> Let's say I need to use several different functions from the module
> 'string'...
> 
> Do I use 'from string import *',  import each function individually, or put
> 'string.' in front of each function?
> 
> I've seen it all three ways.
> 

Oh yes, I did forget something... If you need to reload module later in
the program, like this: reload(module), then you *have* to use import
module; module.func() method of usage. In other two, functions get
imported, but when you reload the module, functions are still the 'old'
ones. You can still do import module as mod and then do reload(mod),
though.

- Andrei 

-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org