On 26/04/13 13:03, MRAB wrote:
But there _is_ an ordering problem, in that the days wrap around.

Do we want a CircularEnum, then?

Ordering would be defined only up to the starting
value, which you would be required to specify when
doing anything where it mattered.

class Day(CircularEnum):

   sunday = 0
   monday = 1
   ...
   saturday = 6

list(Day.startingat(Day.tuesday)) -->
   [Day.tuesday, Day,wednesday, Day.thursday,
    Day.friday, Day.saturday, Day.sunday,
    Day.monday]

Modular arithmetic would apply, so

Day.saturday + 3 --> Day.tuesday

That would be the replacement for Day(3),
which would be disallowed.

--
Greg
_______________________________________________
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

Reply via email to