I want to avoid having duplicate triangles in a list, so I'm trying to use a set.
I wonder why the following two frozensets are added to my set in the first place, as the hashes are invariant of the order:
print("set:", {
frozenset([Triangle(P(0,0), P(0,1), P(0,2)), Triangle(P(0,1), P(0,3), P(0,2))]),
frozenset([Triangle(P(0,2), P(0,1), P(0,0)), Triangle(P(0,1), P(0,3), P(0,2))])
})
P's__hash__function returnshash((self.x, self.y))Triangle's returnshash(frozenset([self.a, self.b, self.c]))(as I want it to be invariant to the order of the three points)
I'd expect there to be just the first element in the resulting set.