importing question ?

Kenny Tilton ktilton at nyc.rr.com
Fri Nov 29 19:42:17 EST 2002


Kenny Tilton wrote:
> 
>> 'from classes import *' brings all the toplevel objects in classes 
>> into your local namespace, so you can access them just through the 
>> name. Generally, though, I think this is considered bad practice, as 
>> it could create overlaps. 
> 
> 
> I just ran into this and I do not like it, because I have what I 
> consider one little subsystem (Cells) but I have it spread over ten 
> source files. 

I just saw the option to:

   from <package> import *

along with listing all modules in an __all__ definition in the __init__ 
file in the package directory. hope eternal. but it seems I then have to 
qualify any reference with the module name (which I think I grok--it is 
importing everything into the current namespace in go (nice) but then 
leaves them compartmented by module when it does so (not what I wanted, 
viz, a flat namespace for the package).



-- 

  kenny tilton
  clinisys, inc
  ---------------------------------------------------------------
""Well, I've wrestled with reality for thirty-five years, Doctor,
   and I'm happy to state I finally won out over it.""
                                                   Elwood P. Dowd




More information about the Python-list mailing list