2.1.1 global weirds

Alex Martelli aleaxit at yahoo.com
Sun Aug 12 07:50:30 EDT 2001


"Robin Becker" <robin at jessikat.fsnet.co.uk> wrote in message
news:MB4yXKAheld7EwsX at jessikat.fsnet.co.uk...
    ...
> Since circularity is already a potential danger (whether or not the main
> script is involved) I don't think it really adds to the clarity of the
> language that the 'main' script gets treated differently. For example if

Not to the clarity, but to the functionality, when the module (normally
meant to be imported) is run as a main script for the typical purpose,
i.e., unit-testing it.

> I have
>
> #a.py
> print 'in a'
> import b
>
> #b.py
> print 'in b'
> import c
>
> #c.py
> print 'in c'
> import a

These are not modules that run unit tests when run as main scripts.

> I consider that a bit strange since it seems that the special case of
> main script circularity is harder to detect/avoid; I believe that's
> onlyc caused by the special module name.

The special module name 'half-breaks' circularity, just enough to
let you run unit tests decently.


Alex






More information about the Python-list mailing list