title: How to compare a class return with a float or integer?
body: <p>I want to compare the <code>__repr__</code> of a class with a float or an integer.</p>
  
  <pre><code>class TestClass:   
      def __init__(self, a = 5): 
          self.a = a     
      def __repr__(self):
          return self.a
  </code></pre>
  
  <p>This obviously returns an error, because <code>a</code> is not a <code>string</code>:</p>
  
  <pre><code>TypeError: __repr__ returned non-string (type int)
  </code></pre>
  
  <p>If I set it as a string, the print is correct:</p>
  
  <pre><code>&gt;&gt;&gt; TestClass()
  5
  </code></pre>
  
  <p>but the print is not comparable:</p>
  
  <pre><code>&gt;&gt;&gt; TestClass() == 5
  False
  </code></pre>
  
  <p>What should I use to compare the class return to make it <code>TestClass() == 5</code> to <code>True</code>?</p>