Actions
Bug #11422
closedAll common set operations produce incorrect (and surprising) results on a set of sets
Description
Set operations on a set of sets produce incorrect results¶
It seems that almost all common set operations (subtract, superset?, subset?, difference, etc...)
produce (mathematically) incorrect results on a set of sets, in that they just return the set of sets unmodified.
The union, intersection, and exclusion operations produce even weirder results, even when
both parameters are sets of sets – some members of the result are scalar values and some are sets.
2.2.2 :119 > ab = Set.new(['A', 'B'])
=> #<Set: {"A", "B"}>
2.2.2 :120 > c = Set.new(['C'])
=> #<Set: {"C"}>
2.2.2 :121 > abc = Set.new([ab, c])
Substraction fails¶
2.2.2 :122 > abc - c
=> #<Set: {#<Set: {"A", "B"}>, #<Set: {"C"}>}>
Superset fails¶
2.2.2 :140 > abc > ab
=> false
See more examples on pastie.org.
Python just throws TypeError: unhashable type: 'set'
.
Actions
Like0
Like0Like0