-
-
Save wingyiu/b7e71288b33eac8d5fbdea9b38b0f389 to your computer and use it in GitHub Desktop.
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 __new__(cls, *args, **kwargs): | |
instance = super().__new__(cls, *args, **kwargs) | |
instance.__dict__ = cls.__shared_state | |
return instance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment