I come from a solid Java (and Matlab) background, and have been trying to teach myself Python (3.4) recently. In the Java API docs (http://docs.oracle.com/javase/7/docs/api/), the documentation for a particular class always shows a nice overview of the ancestors of that class (see e.g. this screenshot).
Now I'm wondering if there is any way of viewing a similar ancestor hierarchy for Python classes. I am working from the assumption that, since Python is an object-oriented language, all non-primitive types will be objects (please correct me if I'm wrong). Understanding the ancestry for different types should probably greatly aid my understanding of iterables, sequences, views, and lists.
I've tried several things, as suggested in answers to similar questions (such as here); but inspect.mro(cls)
does not always seem to work; for instance, the following gives an error:
inspect.getmro(dict_keys)
even though dict_keys is a type:
In[30]: type({}.keys())
Out[30]: dict_keys
I was also highly surprised to learn that list does not inherit from iterable:
In[34]: inspect.getmro(list)
Out[34]: (list, object)
So, although my question is mainly about how to view (and, ideally, browse) the hierarchy of the standard Python library, any other comments on how to understand the default types' hierarchy, mainly how lists/sequences/views/iterables relate formally, would also be very welcome. The (otherwise excellent) Python tutorial does not really cover this stuff, it seems.