Probably naming it something other than 'globals' would be a good idea -- otherwise you'll hide the builtin globals() function.
But I agree that the attributes of a class instance (as you suggest) or the attributes of a module (as Steve Holden suggests) is probably the right way to go.

I like to use 'runtime' or 'runtime_options' to store the results of command-line options. I wasn't sure about this way of getting Python to handle global variables when I first tried it but after a little experience with it I think it works out pretty well. One thing I did learn though is that it's best to keep these modules simple. Don't make them import or define classes or functions if you can avoid it. It's easy to get into a mess of recursive imports if you start doing that. Just a good newbie tip.


***
if runtime.verbose: print 'Something happened.'
***

--
Michael <[EMAIL PROTECTED]>
http://kavlon.org

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to