On Sun, Jul 25, 2010 at 10:27 AM, Robert Miller <r...@rlmiller.org> wrote:
> On Sun, Jul 25, 2010 at 2:01 PM, Nathann Cohen <nathann.co...@gmail.com> 
> wrote:
>> Nonononoooo, I understood why there are two copies of what appears to
>> be a "zero", and I think it's fine like that !
>
> This is definitely *not* fine, since we have
>
> sage: int(0) == Mod(0, 20)
> True

You seem to want to make the vertex dictionary respect the equivalence
relation defined by Sage equality.  If so, you're going to be in
trouble, since Sage equality actually is not an equivalence relation:

sage: 3 == Mod(7, 4)
True
sage: 3 == Mod(8, 5)
True
sage: Mod(7, 4) == Mod(8, 5)
False

This means that mixing Sage objects of different parents as elements
of a single set or keys of a single dictionary is asking for trouble;
in general, it cannot work (or at least we haven't figured out a way
to make it work).  (As long as you stick to a single parent you should
be fine.)

> So as I said before, the problem is created by line 1084 (in
> sage-4.5/4.5.1) of c_graph.pyx, namely:
>
> {{{ if (not isinstance(u, (int, long, Integer)) or }}}
>
> In fact this should check for any Sage object X for which {{{
> Integer(Y) == X }}} is true for any Y.

Sounds like what you want is "u in ZZ", which is equivalent to "u ==
ZZ(u)" except that it returns False if ZZ(u) fails.

Carl

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to