Skip to content

Instantly share code, notes, and snippets.

@tswedish
Last active May 26, 2020 20:32
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 tswedish/61d64da2dffe79b7b9b60de419ec33e0 to your computer and use it in GitHub Desktop.
Save tswedish/61d64da2dffe79b7b9b60de419ec33e0 to your computer and use it in GitHub Desktop.
def __add__(self, other):
if isinstance(other, self.__class__):
return Variable(lambda a,b : a+b, (self, other))
else:
return Variable(lambda a,b : a+b, (self, Variable(other)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment