[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
Serhiy Storchaka
storchaka at gmail.com
Sat Apr 13 16:45:48 CEST 2013
On 13.04.13 03:13, Glenn Linderman wrote:
> On 4/12/2013 3:59 PM, Guido van Rossum wrote:
>> class Insect(Enum):
>> wasp = 1
>> bee = 1
>> ant = 2
>>
>> We'd have Insect.wasp == Insect.bee < Insect.ant but Insect.wasp is
>> not Insect.bee.
>
> can't define two names in the same enum to have the same value, per the
> PEP.
For current flufl.enum implementations this requires values to be
hashable. An alternative implementation can use comparability (which
already required for repr() and iteration).
More information about the Python-Dev
mailing list