On Sun, Jul 25, 2010 at 6:33 PM, Dan Drake <dr...@kaist.edu> wrote:
> Hello,
>
> Ticket #9590 fixes a problem with hashing; it looks like the hash value
> in the doctest is 32- or 64-bit specific, and of course it fails on
> systems that don't match. The solution there is to change a doctest like
>
>        sage: hash(foo)
>        574575757575
>
> into
>
>        sage: hash(foo) == hash(foo)
>        True
>
> That avoids using the particular value, which we don't really care about
> anyway, but I'm not certain this is a good solution, since the new
> doctest really only tests that the hash function actually returns a
> value.
>
> I don't know much about the hashing functions, so maybe the new doctest
> is fine. There are some other fixes proposed on that ticket; should I
> merge the current fix, or should we use 32-bit and 64-bit tags to use
> different values?

Hmm... looks like the current state of affairs is a mess.  Looking
through the 'def __hash__' grep hits in sage/rings, there are quite a
few of each of the following:

1) no doctest at all
2) provide both 32-bit and 64-bit doctests
3) define your hash function to produce a 32-bit output that's the
same on 32-bit and 64-bit systems; doctest an instance of that output
4) doctest hash value equality without ever showing a doctest output

plus one instance where the hash output is marked "# random".

So whatever you do with this particular patch, it won't make things
much worse :)

As for the desired state of affairs: I have a slight preference for
providing both 32-bit and 64-bit doctest outputs, because it increases
our chance of noticing if something changes unexpectedly.  But I could
also make a good case for only testing hash equality, because it
slightly reduces the effort involved in changing hash functions,
internal representations, etc. :)

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