title: Configuring the Python interpreter so that it stops executing a list of commands whenever one command fails
body: <p>I sometimes paste  a list of commands to be executed in the Python interpreter (<a href="https://docs.python.org/3/tutorial/appendix.html#tut-interac" rel="nofollow noreferrer">Interactive Mode</a>  (<a href="https://web.archive.org/web/20170816015345/https://docs.python.org/3/tutorial/appendix.html" rel="nofollow noreferrer">mirror</a>)). By default, if one command fails (i.e., raises an error), the Python interpreter indicates the command has failed, then executes the subsequent commands.</p>
  
  <p>Is there any way to configure the Python interpreter (Interactive Mode) so that it stops executing a list of commands whenever one command fails?</p>
  
  <hr>
  
  <p>Answering the comments:</p>
  
  <ul>
  <li>I am interested in Linux, Mac OS X and Microsoft Windows.</li>
  <li><p>Code example that I paste in the Python interpreter:</p>
  
  <pre><code>1/0
  print('yo')
  </code></pre>
  
  <p>I don't want <code>yo</code> to be printed, since <code>1/0</code> raises an error.</p></li>
  <li><p>I paste the list of commands, from the clipboard, to the Python interpreter</p></li>
  </ul>