Skip to content

Instantly share code, notes, and snippets.

@rahulkp220
Last active May 7, 2016 15:06
Show Gist options
  • Save rahulkp220/24a0afc1ac38936b8d6d303144e614be to your computer and use it in GitHub Desktop.
Save rahulkp220/24a0afc1ac38936b8d6d303144e614be to your computer and use it in GitHub Desktop.
class mimic_range:
def __init__(self,maximum):
self.maximum = maximum
def __iter__(self):
self.current = 0
return self
def next(self):
num = self.current
if self.current >= self.maximum:
raise StopIteration
self.current += 1
return num
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment