On Thu, May 2, 2013 at 8:57 AM, Barry Warsaw <ba...@python.org> wrote:

> On May 02, 2013, at 08:42 AM, Larry Hastings wrote:
>
> >So, for the second time: How can Color.red and MoreColor.red be the same
> >object when they are of different types?
>
> It's a moot point now given Guido's pronouncement.
>

Correct. There's no Color.red and MoreColor.red. Subclassing is allowed
only of enums that define no members. So this is forbidden:

>>> class MoreColor(Color):
...   pink = 17
...
TypeError: Cannot subclass enumerations

But this is allowed:

>>> class Foo(Enum):
...   def some_behavior(self):
...     pass
...
>>> class Bar(Foo):
...   happy = 1
...   sad = 2
...

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