[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

Ethan Furman ethan at stoneleaf.us
Fri Apr 26 03:15:32 CEST 2013


On 04/25/2013 06:03 PM, MRAB wrote:
> On 26/04/2013 00:59, Glenn Linderman wrote:
>> On 4/25/2013 3:23 PM, Barry Warsaw wrote:
>>> My point is, "days of the week" has a natural ordering, so why wouldn't you
>>> use IntEnum for that?  Problem solved.
>>
>> While the ordering is natural, some implementations start from 0, some
>> start from 1, and on the naming side, some start from Sunday, and some
>> start from Monday. So there are lots of opportunities for the numbers
>> vary, and having easy conversions to int which expose those numbers and
>> allow comparisons to integers, is adding problems, not solving them.
>>
> [snip]
> But there _is_ an ordering problem, in that the days wrap around.

Lots of counting systems wrap: seconds, minutes, hours, days of week, days of month, days of year, millimeters, inches, 
etc., etc., and so forth.  We still apply ordering to them, and talk about 15 <whatevers> being less than 42 <whatevers>.

--
~Ethan~


More information about the Python-Dev mailing list