Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Test for Set equality

Inspired by this question, I stumbled in an unexpected difficulty when trying to compare two Sets :

sage: L[:2]
[[
[ 2 -2]  [0 1]  [   0    1]
[-2  1], [0 1], [   0 -1/2]
],
 [
[ 2 -2]  [   0    1]  [0 1]
[-2  1], [   0 -1/2], [0 1]
]]
sage: Set(L[0][1:])==Set(L[1][1:])
False

Quite unexpected... However :

sage: all([u in Set(L[1][1:]) for u in Set(L[0][1:])])
True
sage: all([u in Set(L[0][1:]) for u in Set(L[1][1:])])
True

as expected.

The Sets reference doesn't mention testing forv Sets equality.

Is that a bug, an oversight or an expected behaviour ?