Subclassing int for a revolving control number

Matteo Dell'Amico della at
Tue Jul 20 18:06:52 CEST 2004

Stephen Ferg wrote:
> 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

This can also be spelled as itertools.cycle(xrange(max_number)).


More information about the Python-list mailing list