title: How do I get an overview of the Python hierarchy of types/classes?
body: <p>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 (<a href="http://docs.oracle.com/javase/7/docs/api/" rel="nofollow noreferrer">http://docs.oracle.com/javase/7/docs/api/</a>), the documentation for a particular class always shows a nice overview of the ancestors of that class (see e.g. <a href="https://i.imgur.com/tA7ataB.png" rel="nofollow noreferrer">this screenshot</a>).</p>
  
  <p>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.</p>
  
  <p>I've tried several things, as suggested in answers to similar questions (such as <a href="https://stackoverflow.com/questions/1401661/python-list-all-base-classes-in-a-hierarchy">here</a>); but <code>inspect.mro(cls)</code> does not always seem to work; for instance, the following gives an error:</p>
  
  <p><code>inspect.getmro(dict_keys)</code></p>
  
  <p>even though dict_keys is a type:</p>
  
  <p><code>In[30]: type({}.keys())
  Out[30]: dict_keys</code></p>
  
  <p>I was also highly surprised to learn that list does not inherit from iterable:</p>
  
  <p><code>In[34]: inspect.getmro(list)
  Out[34]: (list, object)
  </code></p>
  
  <p>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.</p>