Python __repr__ for numbers?
<p>I have the following (example) code:</p>

<pre><code>class _1DCoord():
    def __init__(self, i):
        self.i = i

    def pixels(self):
        return self.i

    def tiles(self):
        return self.i/TILE_WIDTH
</code></pre>

<p>What I want to do is this:</p>

<pre><code>&gt;&gt;&gt; xcoord = _1DCoord(42)
&gt;&gt;&gt; print xcoord 
42 
</code></pre>

<p>But instead I see this:</p>

<pre><code>&gt;&gt;&gt; xcoord = _1DCoord(42)
&gt;&gt;&gt; print xcoord
&lt;_1DCoord instance at 0x1e78b00&gt;
</code></pre>

<p>I tried using __repr__ as follows:</p>

<pre><code>def __repr__(self): 
    return self.i
</code></pre>

<p>But __repr__ can only return a string.
Is there any way to do what I'm trying to do, or should I just give up and use pixels()?</p>
