#13186: Equality of Factorizations
-------------------------------------+-------------------------------------
       Reporter:  caruso             |        Owner:  tbd
           Type:  defect             |       Status:  needs_work
       Priority:  minor              |    Milestone:  sage-6.4
      Component:  factorization      |   Resolution:
       Keywords:  equality           |    Merged in:
  factorization                      |    Reviewers:
        Authors:                     |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:  u/chapoton/13186   |  84b36a2056754713bc05056b28e7bb9ab86b0f24
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by vdelecroix):

 * status:  needs_review => needs_work


Comment:

 Hello,

 Please add specifications to the doc! It is not clear to me (and to you as
 well looking at comment:8) what should be an equality between element.

 I really found weird the begining
 {{{
 if not isinstance(other, Factorization):
     return self.value() == other
 }}}
 how can you compare a factorization with something else. Would you like
 that
 {{{
 sage: [1,2,3] == (1,2,3)
 True
 }}}

 Instead of using `Sequence`, what about
 {{{
 sage: from sage.structure.element import get_coercion_model
 sage: cm = get_coercion_model()
 sage: cm.common_parent(1,1/2)
 Rational field
 }}}
 (not so important, as at the end of the day the same code is called)

 If the ring is commutative your test is wrong as the elements of the
 underlying universe are not necessarily sortable... you can not assume
 that the order is the same based on the fact that you call `sorted`. It
 might also depend on the specification you will add...

 You need to define a `__ne__` if you want that `!=` works as well.
 Basically it would be
 {{{
 def __ne__(self, other):
     return not (self == other)
 }}}

 Vincent

--
Ticket URL: <http://trac.sagemath.org/ticket/13186#comment:13>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to