Lie Ryan dixit:

> only use "from module import *" if the 
> module was designed for such use 

In most cases, this translates to: the imported module defines __names__, which 
holds the list of names (of the objects) to be exported. Check it.
Below, a,b,c,f,g,X,Y are defined, but only c,g,Y are exported. This means "from 
mod import *" will only import these names. Without __names__ defined, it would 
import all.

### module mod.py ###

__names__ = ['c','g','Y']

a = ...
b = ...
c = ...

def f():
    ...
def g():
    ...

class X(object):
    ...
class Y(object):
    ...


Denis
________________________________

la vita e estrany

http://spir.wikidot.com/
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to