singleton ... again

Ben Finney ben+python at
Thu Feb 13 04:07:55 CET 2014

Steven D'Aprano <steve at> writes:

> On Wed, 12 Feb 2014 23:04:32 +1300, Gregory Ewing wrote:
> > If you really want to make sure nobody creates another instance by
> > accident, delete the class out of the namespace after instantiating
> > it.
> That does not work. It is trivial to get the type from an instance [by
> calling ‘type(foo)’].

Right, but surely you don't think people would do that “by accident”,
which is what Gregory was addressing.

 \            Hercules Grytpype-Thynne: “Well, Neddie, I'm going to be |
  `\      frank.”  Ned Seagoon: “Right, I'll be Tom.”  Count Moriarty: |
_o__)           “I'll be Gladys.” *slap* —The Goon Show, _World War I_ |
Ben Finney

More information about the Python-list mailing list