This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author poddster
Recipients docs@python, johnnyd, mark.dickinson, poddster, rhettinger, serhiy.storchaka, vstinner
Date 2018-07-16.19:25:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1531769112.43.0.56676864532.issue32554@psf.upfronthosting.co.za>
In-reply-to
Content
a) This below issue added doc to py2.7 that calls out PYTHONHASHSEED, but py doesn't currently contain those words

https://bugs.python.org/issue27706

It'd be useful to have the something whether the "behaviour" is fixed or not, as providing other objects (like a tuple) will still be non-deterministic.

b) I don't know if this is the correct issue to heap this on, but I think it might as you're looking at changing the seed function? 

The documentation for `object.__hash__` calls out `str`, `bytes` and `datetime` as being affected by `PYTHONHASHSEED`. Doesn't it seem odd that there's a workaround in the seed function for str and bytes, but not for datetime?

https://docs.python.org/3/reference/datamodel.html#object.__hash__

I mainly point this out as seeding random with the current date/time is idiomatic in many languages and environments (usually used when you log the seed to be able to recreate things later, or just blindly copying the historical use `srand(time(NULL))` from C programs!). Anyone shoving a datetime straight into seed() is going to find it non-deterministic and might not understand why, or even notice, especially as the documentation for seed() doesn't call this out. 

Those "in the know" will get a unix timestamp out of the datetime and put that in seed instead, but I feel that falls under the same argument as users-in-the-know SHA512ing a string, mentioned above, which is undesirable and apparently something the function should implement and not users.

Would it be wise for datetime to have a specific implementation as well?
History
Date User Action Args
2018-07-16 19:25:12poddstersetrecipients: + poddster, rhettinger, mark.dickinson, vstinner, docs@python, serhiy.storchaka, johnnyd
2018-07-16 19:25:12poddstersetmessageid: <1531769112.43.0.56676864532.issue32554@psf.upfronthosting.co.za>
2018-07-16 19:25:12poddsterlinkissue32554 messages
2018-07-16 19:25:12poddstercreate