ete3

How to remove duplicates in list of objects without __hash__

蹲街弑〆低调 提交于 2020-01-24 04:10:26
问题 I have a list of custom objects from which I want to remove the duplicates. Normally, you would do this by defining both __eq__ and __hash__ for your objects and then taking the set of the list of objects. I have defined __eq__ , but I can't figure out a good way to implement __hash__ such that it returns the same value for objects that are equal. More specifically, I have a class that is derived from the Tree class from the ete3 toolkit. I have defined two objects to be equal if their