title: How to decorate all the comparison methods inheriting from tuple
body: <p><strong>Problem</strong></p>
  <p>Version is being expressed as string and compared at lot of places. But then &quot;5.10&quot;  <code>is less than</code> &quot;5.2&quot; due to ASCII comparison</p>
  <p><strong>Solution</strong></p>
  <p>Change it to <code>tuple</code> and then compare. Since comparison is at multiple places, I thought of having a custom class inheriting from <code>tuple</code> and handle the comparison myself</p>
  <p><strong>Proposed code</strong></p>
  <pre><code>class Version(tuple):
    def __new__(self, v1):
      if not isinstance(v1, tuple):
        v1 = tuple(map(lambda x: int(x), v1.split('.')))
      return tuple.__new__(Version, v1)
  
    def __lt__(self, other):
      if not isinstance(other, tuple):
        other = tuple(map(lambda x: int(x), other.split('.')))
      return super().__lt__(other)
  
    def __repr__(self):
      return '.'.join(str(x) for x in self)
  </code></pre>
  <p>This is the code I came up with, so far, and it seems to work fine for cases like:</p>
  <pre><code>v1 = Version(&quot;5.10&quot;)
  print(v1 &lt; &quot;5.2&quot;)
  </code></pre>
  <p>The question I have is, how can I avoid doing the same thing for all the other methods <code>__le__</code>, <code>__gt__</code> etc.</p>
  <p>There should be a more pythonic way to just massage the <code>other</code> argument and convert it to <code>tuple</code>, then call the base class corresponding method</p>