While working on a bug in the issue tracker, I came across something that I 
thought was a little odd around the behaviour of IntEnum. Should the behaviour 
of an instance of an IntEnum not be symmetric to an int where possible? For 
example:

>>> class MyEnum(IntEnum):
...     FOO = 1
...
>>> MyEnum.FOO == 1
True
>>> MyEnum.FOO * 3 == 3
True
>>> str(MyEnum.FOO) == str(1)
False

In my mind, the string representation here should be ā€œ1ā€ and not the label. Was 
this simply an oversight of the specialized IntEnum implementation, or was 
there a concrete reason for this that I’m not seeing?

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to