Enum with only a single member

Ethan Furman ethan at stoneleaf.us
Tue Jan 10 03:51:45 EST 2017


On 01/10/2017 12:37 AM, Chris Angelico wrote:
> On Tue, Jan 10, 2017 at 7:33 PM, Paul Rubin wrote:

>>> That is, a singleton enum?
>>
>> Why stop there?  You can make empty ones too.  (Zerotons?)
>
> Sure you *can*, but I can't think of any time they'd be useful. Can
> you give an example?

Sure.  Any time you have some base behaviour you want shared amongst multiple Enum classes.  ;)

--
~Ethan~



More information about the Python-list mailing list