osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Enums: making a single enum


Ian Kelly <ian.g.kelly at gmail.com>:

> On Fri, May 25, 2018 at 11:00 PM, Chris Angelico <rosuav at gmail.com> wrote:
>> On Sat, May 26, 2018 at 2:46 PM, Steven D'Aprano
>>> class State(Enum):
>>>     Maybe = 2
>>
>> # Tri-state logic
>> Maybe = object()
>
> The enum has a nice __str__ though.

That's why I usually use string sentinels:

  Maybe = "Maybe"


Marko