Subclassing int for a revolving control number

Stephen Ferg steve at ferg.org
Mon Jul 19 20:10:35 CEST 2004


I think the simplest solution would be just to use a generator...

************************************
def rollover(argMaxNumber=20):
	while True:
		for i in range(1, argMaxNumber+1):
			yield i

########### test the rollover generator...

r = rollover(5)
for i in range(33):
	print i, "=", r.next()
*************************************



More information about the Python-list mailing list