[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library (original) (raw)
Ethan Furman ethan at stoneleaf.us
Thu Apr 25 17:46:22 CEST 2013
- Previous message: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
- Next message: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 04/25/2013 06:03 AM, Eli Bendersky wrote:
The call syntax has been repurposed for the convenience API: --> Animals = Enum('Animals', 'ant bee cat dog') --> Animals <Animals {ant: 1, bee: 2, cat: 3, dog: 4}> --> Animals.ant <EnumValue: Animals.ant [value=1]> --> Animals.ant.value 1 The aforementioned deprecated syntax refers to call with a single arguments (the convenience API by definition requires more than one).
I don't understand why having Enum() be the convenience function rules out Animals(1)
from returning Animals.ant
.
--
Ethan
- Previous message: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
- Next message: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]