other python ideas

Arnold deVos adv at langdale.com.au
Tue May 23 18:18:03 EDT 2000


The real problem is that a module exports all the symbols it has imported.
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.

- Arnold

Martijn Faassen <m.faassen at vet.uu.nl> wrote in message
news:8gdosh$l78$1 at newshost.accu.uu.nl...
> Steven D. Arnold <stevena at permanent.cc> wrote:
> [snip]
> > The programmer should be able to mark certain names as
> > "not-for-export."  The `*' set would not export such names, though if
the
> > module user were to import the name specifically, that would override
the
> > "not-for-export" flag.
>
> In fact, Guido used his time machine on reading this post, and it already
> exists: just prefix the names you don't want exported with * with an
> underscore.
>
> 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