Generic singleton

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Fri Mar 5 18:07:52 EST 2010


On Fri, 05 Mar 2010 16:25:46 -0500, Terry Reedy wrote:

> On 3/5/2010 1:01 PM, Steven D'Aprano wrote:
>> On Fri, 05 Mar 2010 11:57:13 -0500, Terry Reedy wrote:
>>
>>> On 3/4/2010 10:32 PM, Steven D'Aprano wrote:
>>>
>>>> Python does have it's own singletons, like None, True and False.
>>>
>>> True and False are not singletons.
>>
>> Duotons? Doubletons?
> 
> The latter is what I use.

The Wikipedia article on Singleton states that it is acceptable to 
generalise "Singleton" to allow multiple instances.

http://en.wikipedia.org/wiki/Singleton_pattern

While Doubleton or even Tripleton sound cute, once you get to large 
counts it all starts getting ugly and horrible. "Polyton"? Blah.


[...]
> This is your strongest argument. It has nothing to do in particular with
> (the dubious analogy with) bool. Here is a draft of what you might post
> to python-ideas list, or even the tracker.

Oh, you have misunderstood me. I'm not particularly concerned about 
NoneType's behaviour, and certainly not concerned enough to champion the 
change against any opposition (let alone through the moratorium!). I 
wanted to understand why the difference existed.

Python has at least two other singletons, Ellipsis and NotImplemented, 
and both behave like None.



-- 
Steven



More information about the Python-list mailing list