Skip to content

Instantly share code, notes, and snippets.

@jdswinbank
Created November 17, 2014 22:00
Show Gist options
  • Save jdswinbank/54c91ecd38b39a4bb3fe to your computer and use it in GitHub Desktop.
Save jdswinbank/54c91ecd38b39a4bb3fe to your computer and use it in GitHub Desktop.
class Foo(int):
def __add__(self, other):
return -1
print Foo(2) + 3
@dhuppenkothen
Copy link

you can do:

class int(int):
def add(self, other):
return self - other

2 + 3
5
int(2) + int(3)
-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment