On Fri, Sep 03, 2021 at 03:43:03PM +1000, Chris Angelico wrote: > Yes, although I'd love to have a good term for "there is only ever one > object of this type AND VALUE", rather than "there is only one object > of this type", so that True and False could be discussed the same way > as singletons.
I believe that the "official" Design Pattern name for something that generalisations the Singleton pattern to two or more instances is the Multiton: https://en.wikipedia.org/wiki/Multiton_pattern but most people just use the term "singleton" in the sense that there is only a single True and a single False. Or sometimes "dupleton" or "doubleton". Another term sometimes used is "flyweight", which is also used for interned strings and ints. https://python-patterns.guide/gang-of-four/flyweight/ Interestingly, the term "singleton" was used in Python *before* the Gang Of Four book used it: https://python-patterns.guide/gang-of-four/singleton/ What would you call a class that has *no* instances? Obviously that would only be useful in a language where classes are first-class citizens. Why create a singleton instance if you can just use the class object itself? -- Steve _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/VYR453KSZPMHAFVZZJJQ56VIYKM5QRTV/ Code of Conduct: http://python.org/psf/codeofconduct/