-
-
Save morganthrapp/f8411b82f6a3437bd732 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
def mutate(pointer): | |
pointer += 2 | |
mutate(x) | |
print(x) # 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment