title: When is semicolon use in Python considered "good" or "acceptable"?
body: <p>Python is a &quot;whitespace delimited&quot; language.  However, the use of semicolons <em>are</em> allowed.  For example, the following works, but it is frowned upon:</p>
  <pre><code>print(&quot;Hello!&quot;);
  print(&quot;This is valid&quot;);
  </code></pre>
  <p>I've been using Python for several years now, and the only time I have ever used semicolons is in generating one-time command-line scripts with Python:</p>
  <pre><code>python -c &quot;import inspect, mymodule; print(inspect.getfile(mymodule))&quot;
  </code></pre>
  <p>Or adding code in comments on Stack Overflow (i.e., &quot;you should try <code>import os; print os.path.join(a,b)</code>&quot;)</p>
  <p>I also noticed in <a href="https://stackoverflow.com/a/8236407/1399279">this answer to a similar question</a> that the semicolon can also be used to make one line <code>if</code> blocks, as in</p>
  <pre><code>if x &lt; y &lt; z: print(x); print(y); print(z)
  </code></pre>
  <p>which is convenient for the two usage examples I gave (command-line scripts and comments).</p>
  <hr />
  <p>The above examples are for communicating code in paragraph form or making short snippets, but not something I would expect in a production codebase.</p>
  <p>Here is my question: in Python, is there ever a reason to use the semicolon in a production code?  I imagine that they were added to the language solely for the reasons I have cited, but it’s always possible that <a href="https://en.wikipedia.org/wiki/Guido_van_Rossum" rel="nofollow noreferrer">Guido</a> had a grander scheme in mind.</p>
  <p>No opinions please; I'm looking either for examples from existing code where the semicolon was useful, or some kind of statement from the python docs or from Guido about the use of the semicolon.</p>