#9940: Fix equality/inequality for AdditiveAbelianGroup
-----------------------------+----------------------------------------------
Reporter: mpatel | Owner: joyner
Type: defect | Status: needs_review
Priority: critical | Milestone: sage-4.6.1
Component: group theory | Keywords:
Author: John Palmieri | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-----------------------------+----------------------------------------------
Changes (by mpatel):
* cc: novoselt, vbraun (added)
Comment:
I'm not sure if this helps, but
[http://docs.python.org/reference/datamodel.html#object.__ne__ this
documentation about rich comparisons] says
There are no implied relationships among the comparison operators. The
truth of `x==y` does not imply that `x!=y` is false. Accordingly, when
defining `__eq__()`, one should also define `__ne__()` so that the
operators will behave as expected.
The [http://docs.python.org/reference/datamodel.html#object.__cmp__ entry
for __cmp__] says
If no `__cmp__()`, `__eq__()` or `__ne__()` operation is defined, class
instances are compared by object identity ("address").
Does not having defined
`sage.modules.fg_pid.fgp_module.FGP_Module_class.__ne__` mean that `G !=
H` amounts to `id(G) != id(H)`?
It seems the only other class that derives [directly] from
`FGP_Module_class` is `sage.geometry.toric_lattice.ToricLattice_quotient`,
which also doesn't define its own `__eq__` and `__ne__`:
{{{
#!python
sage: N1 = ToricLattice(3)
sage: sublattice1 = N1.submodule([(1,1,0), (3,2,1)])
sage: Q1 = N1/sublattice1
sage: N2 = ToricLattice(3)
sage: sublattice2 = N2.submodule([(1,1,0), (3,2,1)])
sage: Q2 = N2/sublattice2
sage: Q1 == Q2
True
sage: Q1 != Q2
True
}}}
Is this expected?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9940#comment:11>
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.