Last active
August 29, 2015 14:25
-
-
Save ivandeex/e4d2b2046ea39409dc83 to your computer and use it in GitHub Desktop.
Python Borg vs singleton: we all are one and all that jazz -- http://code.activestate.com/recipes/66531/
This file contains hidden or 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