Roy Smith roy at
Sat Apr 12 05:28:23 CEST 2003

Hunting around for ideas on implementing the singleton pattern in 
Python, I found

It seems like a pretty reasonable implementation, but I don't understand 
one thing about it.  What is the point of:

# Store instance reference as the only member in the handle 
self.__dict__[ '_Singleton__instance' ] = Singleton.__instance

I don't see that it does anything useful.  Is there something subtle 
that I'm missing?

More information about the Python-list mailing list