On Sun, Apr 28, 2013 at 11:50:16PM -0700, Ethan Furman wrote:
> In other words, currently:
>> class Color(Enum):
> red = 1
> green = 2
> blue = 3
>> class MoreColor(Color):
> cyan = 4
> magenta = 5
> yellow = 6
> black = 7
>> MoreColor.red is Color.red # True
Correct.
> But as soon as:
>> type(Color.red) is Color # True
> type(MoreColor.red) is MoreColor # True
I don't believe this is correct. As I understand it, the proposal is the
weaker guarantee:
isinstance(Color.red, Color) # True, possibly using __instancecheck__
Since red is not defined by MoreColor, there's no reason to expect that
it will be a MoreColor instance. As far as I understand it, there is no
guarantee that
isinstance(MoreColor.red, MoreColor)
will be true, even if that is possible using __instancecheck__.
--
Steven