Skip to content

Instantly share code, notes, and snippets.

@calvingiles
Created December 19, 2013 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvingiles/8044794 to your computer and use it in GitHub Desktop.
Save calvingiles/8044794 to your computer and use it in GitHub Desktop.
i++
# Auto-incremented number, starting at 0.
# Relies on function defualts being evaluated only once and lists being mutable.
def ipp(__i=[-1]):
'''This is a dirty hack'''
__i[0] += 1
return __i[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment