On Mon, Apr 29, 2013 at 03:50:22PM -0700, Ethan Furman wrote: > This just doesn't make sense to me: > > --> class Stuff(Enum): > ... blue = 1 > ... china = 'really big country' > ... random = (8273.199, 517) > > --> Stuff.blue.name == 'blue' > --> Stuff.blue.value == 1 > > --> Stuff.china.name == 'china' > --> Stuff.china.value == ???
Quoting the PEP: "In the vast majority of use-cases, one doesn't care what the actual value of an enumeration is. But if the value is important, enumerations can have arbitrary values." http://www.python.org/dev/peps/pep-0435/#id21 So in the above, Stuff.china.value == 'really big country' and Stuff.random.value == (8273.199, 517). Mixing enumeration values like this would be unusual, but it will work. It's no different from having a list [1, 'really big country', (8273.199, 517)]. Lists can deal with it, but if you pass a list of arbitrary types to something that expects a list of ints, it will complain. -- Steven _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com