#9677: Sage Sets don't implement genuine comparison
--------------------------------+-------------------------------------------
Reporter: rlm | Owner: AlexGhitza
Type: defect | Status: needs_work
Priority: major | Milestone: sage-5.0
Component: basic arithmetic | Keywords:
Work_issues: | Upstream: N/A
Reviewer: Mike Hansen | Author: Robert Miller
Merged: | Dependencies:
--------------------------------+-------------------------------------------
Comment(by was):
Replying to [comment:11 dsm]:
> I think the patch behaviour of
>
> {{{
>
> sage: a = [2,3]
> sage: b = [2,3,4j]
> sage: set(a) < set(b)
> True
> sage: Set(a) < Set(b)
> False
>
> }}}
>
> is too dangerous to let pass unremarked.
In Python (according to http://docs.python.org/library/sets.html) for the
set type we have: "The subset and equality comparisons do not generalize
to a complete ordering function. For example, any two disjoint sets are
not equal and are not subsets of each other, so all of the following
return False: a<b, a==b, or a>b. Accordingly, sets do not implement the
__cmp__() method."
The Python convention does make sense and is what most people would
expect... and is the direction Sage should move in.
RLM who wrote "I completely, emphatically disagree." has got sucked up
into an industry job, so isn't involved in Sage development right now, so
I don't think he'll care much what happens with this ticket.
That said, having a total ordering -- which is different and inconsistent
with set's order -- is useful (!). However, it can be done as a separate
explicit function or method, which can get passed to the sort method
explicitly.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9677#comment:12>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.