I have made a function that will output '{0}' when 0 is given and '{1}' for everything else.
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 how I want it to.
if self.x==end_of_loop:
return '{2}'
else:
return self
What I would like to do is offset(1).format('first', 'next') but that only outputs '1' for some reason. What can I do?