checking if an object is an Exception class
<p>I've got some code which does:</p>

<pre><code>try:
    result = func()
except StandardError as e:
    result = e
</code></pre>

<p>How can I check whether <code>result</code> contains an Exception?</p>

<p><del>Using <code>isinstance(result, Exception)</code> doesn't work as exceptions are a class, not an instance, e.g. <code>type(ValueError)</code> gives <code>&lt;type 'type'&gt;</code>.</del></p>

<p>--- Edit ---</p>

<p>Well that was stupid; while the above code was a correct distillation of how I was using <code>func()</code>, what my test <code>func()</code> was doing was <code>return ValueError</code>, not <code>raise ValueError</code>. With the former returning the class and the latter returning an instance. So the problem wasn't as described.</p>