On Apr 23, 2013, at 8:11 AM, Guido van Rossum wrote: > I gotta say, I'm with Antoine here. It's pretty natural (also coming > from other languages) to assume that the class used to define the > enums is also the type of the enum values. Certainly this is how it > works in Java and C++, and I would say it's the same in Pascal and > probably most other languages.
Furthermore, you could define methods/fields on enum values, like Java's enums. E.g.: Errno.EBADF.strerror() -> 'Bad file descriptor' Easily adapt to additional fields: class Protocol(Enum): HOPOPT = 0, "IPv6 Hop-by-Hop Option" ICMP = 1, "Internet Control Message" IGMP = 2, "Internet Group Management" @property def value(self): return self._value[0] @property def description(self): return self._value[1] -- Philip Jenvey _______________________________________________ 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