|
From: Kevin A. <al...@se...> - 2001-12-13 01:47:40
|
There are a number of classes in the framework implemented as singletons and they are done in a variety of different ways. If you don't already know what a singleton is and you follow the links below, you'll find out what they are. Configuration (config.py), ObjectLookup and EventQueue (event.py), and Log (log.py) are all supposed to be singletons. There are probably other single classes in the framework, but a quick search of the yielded the ones above. There is a Python Cookbook section dealing with singletons here: http://aspn.activestate.com/ASPN/search?query=singleton§ion=PYTHONCKBK&t ype=Subsection I have to admit that the Borg recipe is appealing http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531 I think it would be beneficial to standardize on one pattern for "singletons" and update the framework. Any preferences or suggestions? On a related note, the time has probably come for a generic util.py or misc.py module where we place our generic helper classes and functions used by other modules. I've already run into one or two import problems because of the readAndEvalFile function in res.py which is a generic helper function which needs to be taken out of res.py. ka |