Suppose I have an object called Node
Node has two properties, name and age
I have a set of Nodes called set1 and another called set2
I want to get the intersection of set1 and set2.
However I want the comparisons within the intersection method to be purely based on the name property.
This is done by overriding the __eq__ method.
This means if Node("Jenna", 54) existed in set1 and Node("Jenna", 29) existed in set2 then one of those Nodes will exist in the instersection.
How do I force the intersection to keep the Node from set1 if it exists in the intersection with set2.
I.e - in the above example, how do I force the intersection to contain Node("Jenna", 54) and NOT Node("Jenna", 29) ?
Any ideas?