0

Is it possible to lexicographically sort a list of frozensets as in the following example:

sort_frozensets(frozenset(['d','b']), frozenset(['a','b']), frozenset(['z','a']), frozenset(['l',''m]))
#result = frozenset(['a','b']), frozenset(['z','a']), frozenset(['d','b']), frozenset(['l',''m])

So, it's ordered through the order of the first item, and if the first item is the same, then the second item is considered.

CairoMisr
  • 81
  • 5

1 Answers1

1

No, frozensets do not have an order, so you can't sort them. Find another data structure that fits your problem, we won't be able to guess it.

psarka
  • 1,562
  • 1
  • 13
  • 25