| ▲ | morshu9001 2 days ago | |||||||
tuple(sorted(s)) and if you can't even sort the values, they're probably not hashable. I get that this involves a copy, but so does frozenset, and you can cross that bridge in various ways if it's ever a problem. | ||||||||
| ▲ | boothby 2 days ago | parent [-] | |||||||
Here are some types that support hashing:
Aside from int and float, you cannot perform comparisons between objects of different types. Moreover, you cannot sort complex numbers at all.I have crossed that bridge, and I'm telling you (again) that a sorted tuple is not a generic solution. | ||||||||
| ||||||||