title: Implementation of `Exception.__str__()` in Python
body: <p>I've never fully understood exception handling in Python (or any language to be honest). I was experimenting with custom exceptions, and found the following behaviour.</p>
  
  <pre><code>class MyError(Exception):
      def __init__(self, anything):
          pass
  
  me = MyError("iiiiii")
  print(me)
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>iiiiii
  </code></pre>
  
  <p>I assume that <code>print()</code> calls <code>Exception.__str__()</code>.</p>
  
  <p>How does the base class <code>Exception</code> know to print <code>iiiiii</code>? The string <code>"iiiiii"</code> was passed to the constructor of <code>MyError</code> via the argument <code>anything</code>, but <code>anything</code> isn't stored anywhere in <code>MyError</code> at all!</p>
  
  <p>Furthermore, the constructor of <code>MyError</code> does not call its superclass's (Exception's) constructor. So, how did <code>print(me)</code> print <code>iiiiii</code>?</p>