0
What is the meaning of these lines
If __ne__ is not implemented, it returns the opposite of __eq__. There are no other relationships between the other operators.
2 Réponses
+ 5
class Class:
def __init__(self, a):
self.a = a
def __eq__(self, other):
return self.a == 'a' and other == 'b'
a = Class('a')
print(a == 'b')
print(a != 'b') #not a == 'b'
+ 1
check out the comments in the lesson.