Or just use modules. Seriously, it is a true singleton.
This is not amenable to inheritance tho, however there is a strong argument against inheritance in singletons anyway. Further, the borg pattern is considered "more pythonic" in the case of inheritable singletons, as frequently what is desired in such cases is shared state vs instead of shared identity.
Just don't reload it.
from foo import barIn the general case, yes. Unfortunately, due to some quirks in the module loader, assigning bar right inside foo might not yield the expected result, though.
This is actually one of the python warts that annoys me the most.