Author jason.curtis
Recipients jason.curtis
Date 2019-07-01.23:24:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Combining int and Enum, as with enum.IntEnum results in a class where __str__ cannot be effectively overridden. For example:

from enum import IntEnum

class myIntEnum(IntEnum):
    x = 1
    def __str__(self):
        return 'aaaaAAAa'
f'{myIntEnum.x}, {str(myIntEnum.x)}'

Expected output:
'aaaaAAAa, aaaaAAAa'

Actual output:
'1, aaaaAAAa'

Overriding __str__ in this way works as expected if the inherited classes are int or Enum individually. However, it does not work when inheriting (int, Enum) or when inheriting (intEnum).

Presumably this is a side effect of Enum's mixin behavior documented at and it is possibly related to .
Date User Action Args
2019-07-01 23:24:11jason.curtissetrecipients: + jason.curtis
2019-07-01 23:24:11jason.curtissetmessageid: <>
2019-07-01 23:24:11jason.curtislinkissue37479 messages
2019-07-01 23:24:11jason.curtiscreate