Category archives for Singleton

Singleton pattern for Python (single and multi-threaded)

Goals: Provide single point of access, to a one and only instance of a class Support lazy (on-demand) instantiation Support single and multi-threaded RT environment Challenges: Python does not support constructor hiding (i.e. marking as private) Proving I’m right – CPython does not really support multi-threading, due to its Global Interpreter Lock What’s good here? Instead of […]