Another software design question: program-level globals

John Roth newsgroups at jhrothjr.com
Fri Feb 13 17:35:47 EST 2004


"Robin Munn" <rmunn at pobox.com> wrote in message
news:KV8Xb.6707$PY.2127 at newssvr26.news.prodigy.com...
> OK, here's another software design question, one that's been bugging me
> for a while now. What do y'all think is the best way to handle
> program-level globals, such as configuration option -- especially in
> multi-module programs?

You've basically got it: modules are inherently singletons.
I would, of course, dress up your solution by putting the
configuration reader and so forth into a class, and possibly
putting that behind some kind of proxy so I could easily
slide in mock objects for testing.

John Roth

> -- 
> Robin Munn
> rmunn at pobox.com





More information about the Python-list mailing list