Message99110
| Author |
pitrou |
| Recipients |
loewis, mark.dickinson, michael.foord, pitrou, rhettinger, terrence |
| Date |
2010年02月09日.11:43:49 |
| SpamBayes Score |
0.0036289436 |
| Marked as misclassified |
No |
| Message-id |
<1265715830.92.0.470878100189.issue7889@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Well, ideally we should drop the automatic hash() and only accept:
1) ints/longs
2) buffer-like objects
(and tell people to hash() explicitly if they want to)
If that's too disruptive, we should document it.
And, for 3.x, provide the following recipe to hash from a bytes object without losing entropy, and keeping the same results under 32-bit and 64-bit builds:
>>> import random
>>> random.seed(int.from_bytes(b'foo', 'little'))
>>> random.random()
0.08384169414918807 |
|