other python ideas

Martijn Faassen m.faassen at vet.uu.nl
Thu May 25 07:59:03 EDT 2000


Jeff Massung <jmassung at magpiesystems.com> wrote:

> Arnold de Vos wrote in message
> <392b1f96$0$2624 at news01.syd.optusnet.com.au>...
>>Yep.  As pointed out on this group from time to time, import from * can be
>>harmful.

> I'm new to Python - I'm understand why it is harmful (finally ;) - but was
> wondering, if it is that harmful, why have it to being with (what good can
> come from using it)?

Sometimes you have a module from which you do want to import everything
else; you see it frequently when there's a raw C binding and a higher level
Python library on top of that. The higher level library imports * from
the lower-level library.

> Also, what would be the harm in removing "passed down importing" (that's the
> only way I could think of to state it)? If y imports z and z imports y, why
> not have z have to import x to get the functionality of x, too?

This kind of thing isn't a problem as long as you don't use * more than
in a few exceptional cases. I haven't tripped over this one at all
yet, myself.

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list