Olaf Nowacki wrote:
- as classes
- as modules or
- as singleton-pattern classes?
what do you think are the pros and cons of each aproach?
I always like using a module as a container for all my singletons and
shared globals. Python modules already work this way, making it a
natural fit.
Python can build a class that is a "true" singleton. It involves
overriding the __new__ operator. But usually it's easier to write a
"GetMySingleton()" type of function that builds and remembers the class
of your type.