title: Is there a convention for indicating a quantity's units in Python code?
body: <p><em>Please note that I'm coming at this from the point of view of <strong>human readability</strong> rather than informing the program itself of the units in use.</em></p>
  <hr />
  <p>I'm working on a project at the moment with strong links to <strong>mechanical engineering</strong>, and one of the issues that has come up a couple of times is that it's not clear from my code what <strong>units</strong> a given quantity - usually a constant, but the criticism could be extended to some variables as well - is measured in.</p>
  <p>At the moment, I'm doing this:</p>
  <pre class="lang-py prettyprint-override"><code>length = 28
  # ^^^ measured in mm ^^^
  </code></pre>
  <p>But this feels hacky and a bit ugly. I could do this:</p>
  <pre class="lang-py prettyprint-override"><code>length = 28 # &lt;&lt;&lt; measured in mm
  </code></pre>
  <p>That looks better, but I had it drummed into me at university that inline comments are Satanic, and it's a prejudice I'm having trouble letting go of. (Although, having said that, I was only taught C and Java in university, where the pitfalls of inline comments are more obvious. Are inline comments acceptable in Python?)</p>
  <p>Is there some <strong>useful convention</strong> dictating how to indicate a quantity's units in a clear and elegant fashion? Or am I on my own on this one?</p>