Ben Finney <[email protected]> writes: > Gregory Ewing <[email protected]> writes: > >> Roy Smith wrote: >> > It looks to me like he's trying to implement a classic Gang of Four >> > singleton pattern. >> >> Which I've never really seen the point of in Python, or any other >> language for that matter. Just create one instance of the class during >> initialisation, put it in a global somewhere, and use it thereafter. > > Make that “somewhere” a module namespace, and you effectively have a > Singleton for all practical purposes. So yes, I see the point of it; but > we already have it built in :-)
There is a use case for a singleton class: when creating the singleton object takes considerable resources and you don't need it always in your program. -- Piet van Oostrum <[email protected]> WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list
