id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,work_issues,upstream,reviewer,author,merged,dependencies,stopgaps
9181,Update dev-guide : __hash__ return a long,hivert,hivert,"From [http://groups.google.com/group/sage-devel/browse_thread/thread/f68986cb2d436554 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.
}}}",defect,closed,major,sage-4.7,documentation,fixed,__hash__,,,N/A,Nicolas M. Thiéry,Florent Hivert,sage-4.7.rc0,,
