[Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as
Ethan Furman
ethan at stoneleaf.us
Mon Feb 25 20:07:13 CET 2013
More information about the Python-Dev mailing list
Mon Feb 25 20:07:13 CET 2013
- Previous message: [Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as
- Next message: [Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 02/25/2013 10:49 AM, Antoine Pitrou wrote: > On Mon, 25 Feb 2013 09:03:06 -0800 > Eli Bendersky <eliben at gmail.com> wrote: >> >> "DOG" > "CAT" invokes lexicographical comparison between two strings, a >> well-defined and sensical operations. It simply means that in a sorted list >> of strings, "CAT" will come before "DOG". This is different from an >> enumeration that attempts to (at least logically) restrict a value to a set >> of pre-defined entities. > > No, it's not different. Like there are use cases for ordered > comparisons of strings, there are cases for ordered comparisons of > enums. > For example, if I have an enum representing SIP or HTTP response codes, > it is perfectly reasonable to write: > > if code < 200: > # temporary response > ... > elif code < 400: > # successful final response > ... > else: > # final error response: > ... > > Really, there's no justification for claiming an enum should never > compare to anything else. It's entirely application-dependent. +1
- Previous message: [Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as
- Next message: [Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list