[New-bugs-announce] [issue22505] Expose an Enum object's serial number

Ram Rachum report at bugs.python.org
Sat Sep 27 16:40:46 CEST 2014


New submission from Ram Rachum:

I'd like Enum objects to expose their serial numbers. Currently it seems the only way to get this is `MyEnum._member_names_.index(my_enum.name)`, which is not cool because it's cumbersome and involves private variables.

Perhaps we can use `int(my_enum) == 7`? Or `my_enum.number == 7`? I'll be happy to make a patch if there's agreement about this.

----------
components: Library (Lib)
messages: 227679
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Expose an Enum object's serial number
type: enhancement
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22505>
_______________________________________


More information about the New-bugs-announce mailing list