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