title: Class extension in python like in swift?
body: <p>I am new to python, coming from swift and I am wondering about the following. In swift if I would like to add a functionality to an an existing class, I can do something like this (as in the book example):</p>
  
  <pre><code>extension Double {
      var km: Double { return self * 1_000.0 }
      var m: Double { return self }
      var cm: Double { return self / 100.0 }
      var mm: Double { return self / 1_000.0 }
      var ft: Double { return self / 3.28084 }
  }
  let oneInch = 25.4.mm
  </code></pre>
  
  <p>I really like this functionality and I was wondering if there is something similar in python, or there is some other way much better that I do not see and hence this does not make any sense in python.</p>