On Fri, 25 May 2018 23:07:47 -0600, Ian Kelly wrote:
> On Fri, May 25, 2018 at 11:00 PM, Chris Angelico <[email protected]>
> wrote:
>> On Sat, May 26, 2018 at 2:46 PM, Steven D'Aprano
>> <[email protected]> wrote:
[...]
>>> Is there a better way of handling a three-state flag like this?
>>>
>>>
>> Does it need to have a value of 2? If not:
>>
>> # Tri-state logic
>> Maybe = object()
>
> The enum has a nice __str__ though.
Yes, that's why I wanted to use enum.
Also because apparently Enums are the future and nobody uses object() any
more :-)
Actually I don't really need all the features of Enums, I might just
define my own class:
class Maybe:
def __repr__(self):
return "Maybe"
Maybe = Maybe()
I wish there was a simpler way to define symbols with identity but no
state or behaviour...
--
Steve
--
https://mail.python.org/mailman/listinfo/python-list