Last active
August 29, 2015 13:56
-
-
Save cjhanks/9334104 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 Test(object): | |
def __init__(self): | |
self.val = None | |
def __eq__(self, rhs): | |
return self.val == None | |
t_0 = Test() | |
print(t_0 == None) # True | |
print(None == t_0) # True | |
print(t_0 is None) # False | |
print(None is t_0) # False |
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 Test(object): | |
def __init__(self, val): | |
self.val = val | |
def __eq__(self, rhs): | |
return self.val == rhs.val | |
t_0 = Test(0) | |
t_1 = Test(0) | |
print(t_0 == t_1) | |
print(t_0 is t_1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment