[issue36559] "import random" should import hashlib on demand (nor load OpenSSL)

Raymond Hettinger report at bugs.python.org
Tue Apr 9 21:24:01 EDT 2019


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> You could also use the internal _sha512 module. 
> It's always present, small, lean and provides a SHA512
> implementation with sufficient performance.

I suppose we could do this but it borders on telling folks that we're worried about using our own public APIs, that importing hashlib is bad for them.  It shouldn't be that way, hashlib is a collection of hash functions -- it is clear why this import isn't small and fast.  It suggests that something is wrong with the implementation.

The focus on client code in random seems like the wrong focus.  That is just typical of what other clients would do.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36559>
_______________________________________


More information about the Python-bugs-list mailing list