if condition1 and # comment1
condition2: # comment2
would not work because a line is broken in the if statement, however,
if (condition1 and #comment1
condition2): # comment2
would fix the problem and maintain neat code.
if condition1 and # comment1
condition2: # comment2
if (condition1 and #comment1
condition2): # comment2
class C(object):
def __init__(self, x):
self.a = x
def __eq__(self, o):
return self.a == o.a
def __str__(self):
return str(self.a)
s = set()
a = C(1)
b = C(2)
c = C(3)
s.add(a)
s.add(b)
s.add(c)
s.add(C(1))
class C(object):
def __init__(self, x):
self.a = x
def __eq__(self, o):
return self.a == o.a
def __str__(self):
return str(self.a)
def __hash__(self):
return self.a