New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
py3: fix some doctests about hash for real and complex double #27344
Comments
New commits:
|
Commit: |
Branch: u/chapoton/27344 |
Reviewer: Jeroen Demeyer |
comment:3
Thanks a lot, Jeroen. By the way, would you please give your opinion on #27065 ? |
comment:4
I don't understand these tests. They seem kind of pointless? If we must have doctests for |
comment:5
Ahem.. Time lost will never come back. So, Erik, please tell us exactly what you would like to see as doctests here. Or better, just commit something that suits you and pass on both py2 and py3. |
comment:6
I'm sorry, I'd be frustrated too, but in the same vein I don't think we should waste time writing pointless doctests that prove nothing. I personally have no idea what the intent is here for these classes implementing |
comment:7
Just looking at the code I have no reason--it's not documented anywhere--why RDF has to be hashable at all. I'm sure there's a reason, but it would be nice if that were actually explained somewhere. Furthermore I have no idea, even if the class is intended to be used as a singleton, why its hash it set to a (seemingly) arbitrary integer, nor why the old test expected that value to be equivalent to |
comment:8
The commit where the original test for RDF was written to its previous form (I'll look at CDF separately) just says "Clean up the fallout from the RDF/CDF hashing patch" which doesn't really answer anything. In particular I don't get the "mod 2!^32" part, although it does appear to hold accurate on Python 2. Though it seems part of the point is that
ISTM part of the point of giving it a fixed value was at some point primarily for some performance purpose, but it's not clear what that purpose was exactly or what benchmark this was targeting. |
comment:9
It's clear to me that the only thing that matters is that |
comment:10
Replying to @embray:
I think the reason for this, at least, was that on 32-bit Python the str hashing function overflows, whereas on 64-bit it isn't as likely to overflow for a short string, but either way between 32-bit and 64-bit the hash values wind up the same modulo 2^!32. That still raises the question of why there was a desire for |
comment:11
Replying to @jdemeyer:
I think then it suffices to demonstrate that |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:14
like that ? |
Changed branch from u/chapoton/27344 to |
Component: python3
Author: Frédéric Chapoton
Branch/Commit:
b7fd196
Reviewer: Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/27344
The text was updated successfully, but these errors were encountered: