4 ms·
In fact, you could think of Python's None as being a singleton, but True and False being the two allowed instances of a, uh, doubleton? And similarly, states m
by sah 19y ago
In fact, you could think of Python's None as being a singleton, but True and False being the two allowed instances of a, uh, doubleton? And similarly, states might be implemented as a limited set of allowed values of a single class. This reminds me of Haskell's algebraic types.
This maybe isn't quite "Singleton", but it is at least a useful case for limiting the number of allowed values of a class.