Skip to content

Instantly share code, notes, and snippets.

@pigletfly
Created April 10, 2015 07:50
Show Gist options
  • Save pigletfly/64ffb520517ae1dd57ee to your computer and use it in GitHub Desktop.
Save pigletfly/64ffb520517ae1dd57ee to your computer and use it in GitHub Desktop.
def range(start, stop=None, step=None):
result = []
s = 1
if step is not None:
s = step
if stop is not None:
while True:
if start < stop:
result.append(start)
start += s
else:
break
else:
stop, start = start, 0
while True:
if start < stop:
result.append(start)
start += s
else:
break
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment