[Python-Dev] str(IntEnum) (original) (raw)
Demian Brecht demianbrecht at gmail.com
Fri Feb 20 17:38:17 CET 2015
- Previous message: [Python-Dev] cpython: Improve struct cache locality by bring commonly accessed fields close together.
- Next message: [Python-Dev] str(IntEnum)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: <http://mail.python.org/pipermail/python-dev/attachments/20150220/03304c77/attachment.sig>
- Previous message: [Python-Dev] cpython: Improve struct cache locality by bring commonly accessed fields close together.
- Next message: [Python-Dev] str(IntEnum)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]