[New-bugs-announce] [issue22505] Expose an Enum object's serial number
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)
title: Expose an Enum object's serial number
versions: Python 3.5
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce