Nastiness with global vars. How do I avoid?
John Hunter
jdhunter at ace.bsd.uchicago.edu
Wed Nov 27 16:30:15 EST 2002
>>>>> "Rich" == Rich Daley <rich at DELETE_THISowl.me.uk> writes:
Rich> Does anyone have any idea how I could use a Class instead to
Rich> acheive the same functionality? Ideally I'd love to have
Rich> classes for all the different kinds of methods and stuff
Rich> too, but this is the most critical bit.
Often times a borg comes to the rescue when you are inclined to use a
global.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
If you are familiar with the concept of a singleton, this will make
sense to you. If not, a little background reading will shed some
light.
Search google for:
singleton design pattern
John Hunter
More information about the Python-list
mailing list