Created
January 22, 2013 12:30
-
-
Save thejeshgn/4594287 to your computer and use it in GitHub Desktop.
Python singletomn using the state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Borg: | |
__shared_state = {} | |
def __init__(self): | |
self.__dict__ = self.__shared_state | |
# and whatever else you want in your class -- that's all! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment