"configuring" a class
Russ
uymqlp502 at sneakemail.com
Wed Feb 22 20:28:35 EST 2006
I would like to let the user of one of my classes "configure" it by
activating or de-activating a particular behavior (for all instances of
the class).
One way to do this, I figured, is to have a static class variable,
along with a method to set the variable. However, I am stumped as to
how to do that in python. Suggestions welcome.
The next best thing, I figure, is to just use a global variable.
Several "methods" of the class then check the value of the global
variable to determine what to do. The user can then just set the
variable to get the desired behavior.
However, I tried this and it does not seem to work. I imported the
class, then set the global variable. But the new value of the variable
somehow did not get back into the class methods that need to see it.
Can anyone give me a clue about this? If there is a better way, please
let me know. Thanks.
More information about the Python-list
mailing list