On 02/05/13 13:47, Steven D'Aprano wrote:
The most obvious use-case for subclassing enums is to extend them:

class Directions(Enum):
north = 1
east = 2
west = 3
south = 4

class Directions3D(Directions):
up = 5
down = 6

It doesn't necessarily follow that subclassing is the right
mechanism for extending enums, though. If anything, you
really want to "superclass" them. Maybe

  class Directions3D(Enum, extends = Directions):
    up = 5
    down = 6

Then we could have issubclass(Directions, Directions3D)
rather than the reverse.

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