str.format() problem
<p>So I made this class that outputs '{0}' when x=0 or '{1}' for every other value of x.</p>

<pre><code>class offset(str):  
    def __init__(self,x):  
        self.x=x  
    def__repr__(self):
        return repr(str({int(bool(self.x))}))
    def end(self,end_of_loop):
    #ignore this def it works fine
        if self.x==end_of_loop:
            return '{2}'
        else:
            return self
</code></pre>

<p>I want to do this:<br>
<code>offset(1).format('first', 'next')</code><br>
but it will only return the number I give for x as a string.  What am I doing wrong?</p>
