Enums: making a single enum

Marko Rauhamaa marko at pacujo.net
Sat Nov 17 14:03:47 EST 2018


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



More information about the Python-list mailing list