Skip to content

Instantly share code, notes, and snippets.

@morganthrapp
Created February 10, 2016 17:30
Show Gist options
  • Save morganthrapp/0a8a717871cb755eb086 to your computer and use it in GitHub Desktop.
Save morganthrapp/0a8a717871cb755eb086 to your computer and use it in GitHub Desktop.
class Pointer:
def __init__(self, loc=0):
self.location = loc
def __add__(self, other):
self.location += other
return self
def __str__(self):
return str(self.location)
x = Pointer()
print(x) # 0
y = x
x += 1
print(x) # 1
print(y) # 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment