Last active
May 26, 2020 20:32
-
-
Save tswedish/61d64da2dffe79b7b9b60de419ec33e0 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
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