In Python you can override the built-in __dict__ attribute with your own dictionary. The __dict__ holds all the attributes of the Borg class and __shared_state is a static variable. When instantiating a Borg class __init__ is called and it overrides the __dict__ with the static __shared_state, thus each class will have the same brain: __shared_state. If you modify variables, their values will be reflected in __shared_state. :D
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In Python you can override the built-in
__dict__attribute with your own dictionary. The__dict__holds all the attributes of the Borg class and__shared_stateis a static variable. When instantiating a Borg class__init__is called and it overrides the__dict__with the static__shared_state, thus each class will have the same brain:__shared_state. If you modify variables, their values will be reflected in__shared_state. :D