<p>If I have Python code</p>

<pre><code>class A():
    pass
class B():
    pass
class C(A, B):
    pass
</code></pre>

<p>and I have class <code>C</code>, is there a way to iterate through it's super classed (<code>A</code> and <code>B</code>)? Something like pseudocode:</p>

<pre><code>&gt;&gt;&gt; magicGetSuperClasses(C)
(&lt;type 'A'&gt;, &lt;type 'B'&gt;)
</code></pre>

<p>One solution seems to be <a href="http://docs.python.org/lib/module-inspect.html" rel="noreferrer">inspect module</a> and <code>getclasstree</code> function.</p>

<pre><code>def magicGetSuperClasses(cls):
    return [o[0] for o in inspect.getclasstree([cls]) if type(o[0]) == type]
</code></pre>

<p>but is this a "Pythonian" way to achieve the goal?</p>

```
C.__bases__
```
is an array of the super classes, so you could implement your hypothetical function like so:
```
```
def magicGetSuperClasses(cls):
  return cls.__bases__
```
```
But I imagine it would be easier to just reference
```
cls.__bases__
```
directly in most cases.