__value_factory__ should be added when the default is used
Bug #1172870 reported by
Barry Warsaw
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
flufl.enum |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
It should always be possible to get the item factory for an enum through the __value_factory__ attribute (or whatever we end up calling it in the end). It's possible when given explicitly, as is the case for IntEnum:
>>> A = IntEnum('A', 'a b c')
>>> A.__value_factory__
<class 'flufl.
but not if the default is used.
>>> B = Enum('B', 'a b c')
>>> B.__value_factory__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'B' has no attribute '__value_factory__'
When the default is used, we should add this attribute.
Changed in flufl.enum: | |
status: | New → Won't Fix |
To post a comment you must log in.