On 29/04/2013 21:00, Steven D'Aprano wrote:
> On 30/04/13 05:02, MRAB wrote:
>>>> Why is that backwards? MoreColor is a subclass of Color, so
>>> instances of MoreColor are instances of Color, but instances of
>>> Color are not instances of MoreColor. That's normal behaviour for
>>> subclasses. (All cats are mammals, but not all mammals are
>>> cats.)
>>>>> Let's say that Color is red, green, or blue.
>>>> Let's also say that MoreColor is superset of Color, in other words,
>> any of Color, plus cyan, magenta, or yellow.
>>>> Red is a Color and a MoreColor (member of Color and MoreColor).
>>>> Yellow is a MoreColor, but not a Color (member of MoreColor but
>> not Color).
>>>> That's the opposite of the rules of inheritance.
>> Membership != inheritance, you are conflating two independent
> concepts. I would expect that for membership testing, you should say
> "value in MoreColor", not isinstance(value, MoreColor).
>I do know the difference, but it's not helpful that you're creating the
enum with a "class" statement!
> flufl.enum has been in use for Mailman for many years, and I would
> like to hear Barry's opinion on this.
>