-> I second the statement about multi-threading headaches if you use -> globals in this way. -> -> In Aquarium, since I have to support different threading API's (no -> threads, Python threads, coroutines), I put everything in a Context -> object, and then pass that Context object to everything's constructor. -> This isn't as bad as it sounds. It happens automatically when I call -> aquariumFactory(moduleName, *args, **kargs) which does a dynamic -> import, instantiates the class passing the Context object and the -> additional args, and then returns the instance.
You can also write a function to get the variable, _global_var = None def init_global_var(): global _global_var _global_var = GlobalSomethingOrOther() def get_global_var(): return _global_var Then in the case of multithreaded apps, you can change these functions to use a dictionary of "global variables" indexed by thread-id. --titus _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com