3 ms·
Not only impossible in python, but also seems conceptually useless (why would you have a set of frozen sets?).
by gnulinux 5y ago
Not only impossible in python, but also seems conceptually useless (why would you have a set of frozen sets?).
- yifanl 5y agoEnsure uniqueness, i guess? Though you'd lose that when you make the list of sets. I could maybe see something like this as an intermediary result of parsing some horrible, nested obscure message format (except the dict, that baffles me unless the key-value types are reversed?)
- raymondh 5y agoAlmost the entire purpose of frozensets was so that you could have sets of frozensets. It's the only way to have nested sets. Frozensets also work as dictionary keys.
- deltaonefour 5y agoThis is not useless. Why would you have a list of lists? A list is just an iterable container class, which is what a set is. If the need exists for a list of lists then it exists for a set of sets. An example of this is finding all combinations possible non ordered groups of letters given a collection of letters: abadfjiik. A typical algorithm will produce dupes. But if your accumulator is a set of frozen sets you can produce a result with no dupes.
- nisegami 5y agoI guarantee something like that is running in production somewhere in the world (maybe without the list part).