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). flufl.enum has been in use for Mailman for many years, and I would like to hear Barry's opinion on this. -- Steven
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4