Running code on module import

Grant D. Watson vbasicboy at aol.com
Sun May 23 01:26:18 EDT 2004


>I thought your posting had some more substance to it. But now I
>realize you were simply a barbarian not used to the way of the Romans.

I may have visited Rome only to build a mead hall, but I'm building it with
concrete, arches and marble columns.  ;-)

>But if you really want to do things the barbarian way, here is one
>way.

The way you described is quite practical, but not nearly as fun.  If I was just
concerned with making things work, it would do very well.

It just doesn't fall into the "neat hack" category.  My first concept and first
attempts at runmain didn't add anything to "if __name__..."; I just wanted to
see if I could do it, and learn a little bit about Python in the process.  I
still want to see if I can do it, and learn something about Python; my target
is a bit bigger, is all.

Grant D. Watson
grant_watson at yahoo.pleasedontspamme.com
(Please use this address, not my AOL one.)



More information about the Python-list mailing list