#9181: Update dev-guide : __hash__ return a long
------------------------------+---------------------------------------------
Reporter: hivert | Owner: mvngu
Type: defect | Status: new
Priority: major | Milestone: sage-4.4.4
Component: documentation | Keywords:
Author: Florent Hivert | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------------+---------------------------------------------
From sage-devel
{{{
> 1. I think we should update the devguide, or is there something I don't
get ?
No, we should update the developers guide. Despite this sentence, the (c)
return type of "hash" has been a long since Python 2.3 at least, so I
think
this wasn't ever correct for 64-bit long machines. (What was required is
that it fit into a Python int.)
> 2. I'm writing a Cython class which caches the hash value. Which type
> should I
> use for the attribute ? int doesn't work since when trying to store
the
> hash of None in an int I get
>
> OverflowError: value too large to convert to int
>
> Is long ok and portable (it is was is used in a few place in sage) ?
> Should
> we write it in the doc ?
Yes, we should be using C longs here. Under the hood
Python int = C long != C int
Python float = C double != C float
and Python longs have no (native) C equivalent.
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9181>
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.