class Tst:
def __init__(self, x):
self.x=x
def __iter__(self):
return self
def next(self):
if self.x:
o = self.x
self.x = o - 1
return o
raise StopIteration()
a=Tst(5)
for b in a:
print b