Skip to content

Instantly share code, notes, and snippets.

@charnley
Last active May 17, 2017 16:26
Show Gist options
  • Select an option

  • Save charnley/d16bd891dded5e7279f577289fa1c518 to your computer and use it in GitHub Desktop.

Select an option

Save charnley/d16bd891dded5e7279f577289fa1c518 to your computer and use it in GitHub Desktop.
python 2/3 range
from builtins import range
print(type(range(0)))
if type(range(0)) == "list":
range = xrange
print(type(range(0)))
try:
range = xrange
except NameError:
pass
print(type(range(0)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment