#31057 closed Bug (invalid)
Choices enum - Inconsistent values.
Description ¶
Labeled enum members have their values wrapped in tuples:
class E(Choices): FOO = 1 BAR = 2, 'bar' >>> E.FOO.value 1 >>> E.BAR.value (2,)
Change History (2)
comment:1 by , 5 years ago
Cc: | added |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Summary: | Choices enum - Inconsistent values → Choices enum - Inconsistent values. |
comment:2 by , 5 years ago
Could we raise an exception in such case then?
Add something like this to metaclass for example:
if classdict._member_names and cls._member_type_ is object: raise TypeError(...)
Note:
See TracTickets
for help on using tickets.
Choices
are supported if you need a concrete data type other thanint
orstr
. In such cases you should subclassChoices
and the required concrete data type (see documentation and examples), so described usage is not supported. In your case you can useIntegerChoices
.