| ▲ | boothby 2 days ago | ||||||||||||||||
Problem being that sets aren't consistently ordered and conversion to a tuple can result in an exponential (specifically, factorial) explosion in the number of possible keys associated with a single set. Nor can you sort all objects. Safe conversion of sets to tuples for use as keys is possible but the only technique I know requires an auxiliary store of objects (mapping objects to the order in which they were first observed), which doesn't parallelize well. | |||||||||||||||||
| ▲ | morshu9001 2 days ago | parent [-] | ||||||||||||||||
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. | |||||||||||||||||
| |||||||||||||||||