On Mon, Sep 23, 2013 at 07:53:00AM -0700, Guido van Rossum wrote: > there is no rule that because you can > access something on the class you should be able to access it on the > instance. Try asking an instance for its class's __mro__ or __bases__.
It might not be a rule, but it's certainly the norm. I reckon that class attributes that aren't accessible from the instance are significantly more surprising than Color.red.blue. I know I'm in a minority here, but Color.red.blue seems obvious and straightforward to me. The fact that it doesn't work surprises me. Given that instance = Color.red assert isinstance(instance, Color) # well of course it is assert hasattr(Color, "blue") I would expect instance.blue to work, and I'm completely at a loss as to how Enum has managed to prevent it. -- Steven _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com