singleton ... again

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed Feb 12 05:04:32 EST 2014


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.

If you really want to make sure nobody creates
another instance by accident, delete the class
out of the namespace after instantiating it.

-- 
Greg



More information about the Python-list mailing list