other python ideas

Martijn Faassen m.faassen at vet.uu.nl
Wed May 24 01:19:56 CEST 2000


Arnold deVos <adv at langdale.com.au> wrote:
> The real problem is that a module exports all the symbols it has imported.

You mean the real problem with importing '*'? I hardly ever use it. :)

> This sometimes creates a chain of unintentional dependencies between
> modules - a bit like the sort of thing that happens with .h files in C.

> e.g. if I forgot to import string, my code might still work because I import
> x that imports y that imports string.  No amount of testing can reveal this
> error.  Later someone changes the implementation of y, removing string.
> Later still, I run my previously tested code and the error is unexpectedly
> (confusingly) revealed.

This is only the case if you use 'from foo import *'. If you don't do that,
this problem doesn't exist; I can't use 'string' if I don't import 
the 'string' module in my particular module.

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