Skip to content

Instantly share code, notes, and snippets.

@eclecticmiraclecat
Created May 30, 2020 08:59
Show Gist options
  • Save eclecticmiraclecat/7a69209df857d1cce63216ec4f4c4ba4 to your computer and use it in GitHub Desktop.
Save eclecticmiraclecat/7a69209df857d1cce63216ec4f4c4ba4 to your computer and use it in GitHub Desktop.
>>> class Num:
... def __init__(self, value):
... self.value = value
... def __add__(self, other):
... return self.value + other.value
...
>>> num1 = Num(1)
>>> num2 = Num(2)
>>> num1 + num2
3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment