You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>> MyEnum.A
<MyEnum.A: 0x1>
However in Python 3.7/8 it instead prints
>>> MyEnum.A
0x1
It uses HexInt's repr instead of Enum's. Looking at the enum.py module it seems that this occurs for mixin classes that don't define __new__ due to a change in the _get_mixins_ method. If I define a __new__ method on the HexInt class then the expected behavior occurs.
Yes, the change only considered types with their own copy of __new__ to be actual data types, so in 3.6 HexInt was the recognized data type, but in 3.7+ it was int -- which also meant that HexEnum was considered a simple mix-in and its __repr__ was used instead of Enum.__repr__.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: