From: peter.hillerstrom@... Date: 2015-08-08T16:08:28+00:00 Subject: [ruby-core:70273] [Ruby trunk - Bug #11422] All common set operations produce incorrect (and surprising) results on a set of sets Issue #11422 has been updated by Peter Hillerstr��m. Mon_Ouie [pointed out](https://gist.github.com/Mon-Ouie/5efdab278cbabc3922ac) at freenode #Ruby irc channel, that I have different number of��levels that I compare. This works: ```ruby pry(main):9> abc > Set.new([c]) => true pry(main):10> abc - Set.new([c]) => #}> ``` ---------------------------------------- Bug #11422: All common set operations produce incorrect (and surprising) results on a set of sets https://bugs.ruby-lang.org/issues/11422#change-53697 * Author: Peter Hillerstr��m * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.2.2 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- # 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. ```ruby 2.2.2 :119 > ab = Set.new(['A', 'B']) => # 2.2.2 :120 > c = Set.new(['C']) => # 2.2.2 :121 > abc = Set.new([ab, c]) ``` ## Substraction fails ```ruby 2.2.2 :122 > abc - c => #, #}> ``` ## Superset fails ```ruby 2.2.2 :140 > abc > ab => false ``` See [more examples](http://pastie.org/10337538#18) on pastie.org. Python just throws `TypeError: unhashable type: 'set'`. -- https://bugs.ruby-lang.org/