A startup puzzle

Hans Nowak hans at zephyrfalcon.org
Mon Sep 29 17:11:30 EDT 2003


Edward K. Ream wrote:

> I've just about convinced myself there is no good, clean solution to the
> following puzzle.  I wonder if you agree.
> 
> 1. My app has a module called leoGlobals that contains often-used global
> functions.  All of Leo's source files start with:
> 
> from leoGlobals import *
> 
> I don't want to discuss whether this is good style: it is simple and it
> works well for me :-)

Fair enough, but it's not just a matter of style... using something like

   import leoGlobals as g

would probably have avoided this problem, since you can do:

   import leoGlobals as g

   # later...
   g.app = leoApp.leoApp()
   # every module that imported leoGlobals now knows g.app as well

Cheers,

-- 
Hans (hans at zephyrfalcon.org)
http://zephyrfalcon.org/







More information about the Python-list mailing list