(slightly OT): Python and linux - very cool

Delaney, Timothy tdelaney at avaya.com
Fri Aug 2 02:33:16 CEST 2002


> From: James J. Besemer [mailto:jb at cascade-sys.com]
> 
> I submit that in cases like this, where modules rely on
> privacy for the integrity of their operation, then ideally
> they should be designed from the start to be immune
> from "import *" problems such as you describe.

How can they be? Any time they export *anything* it may clobber the
namespace of the importing module.

In particular if someone does something like

from a import *
from b import *

where

a exports c, d, e
b exports f, g, h

and then a new version of b is installed

b exports d, f, g, h

then you've got a problem whether or not the authors of a and b tried to be
"immune" to imort * problems.

IMO it is up to the user to ensure that they only import what they need ...
from ... import * is IMO one of the biggest warts of Python as it can cause
very obscure bugs.

Tim Delaney




More information about the Python-list mailing list