
On Tue, Oct 6, 2015 at 7:07 PM, Steven D'Aprano <steve@pearwood.info> wrote:
On Tue, Oct 06, 2015 at 11:26:11AM -0700, Guido van Rossum wrote:
This is already looking good. An additional advantage to having a new module (as opposed to changing random) is that it could easily be backported as a PyPI package, all the way back to Python 2.7.
I do still think that having a concrete proposal for what should (initially) go into secrets.py would make for a more compelling PEP.
Thanks Guido.
I'm not sure how much more concrete a proposal you are looking for. The PEP now lists a sample implementation. I've described it as "pseudo-code" only to indicate that it may be incomplete (e.g. missing some imports to make it work, lacking in error checking). It also lacks docstrings and tests, but otherwise I think it is most of the module.
Hm... I totally did not find that when I read the PEP and even just now I almost missed it! What I had expected was something that could be directly committed into the stlib, similar to the statistics.py module you contributed. But apparently it's so small it could be inlined and overlooked! :-) Maybe you could clean it up, write some tests, and publish it somewhere? (Not sure if you do GitHub. :-) One bikeshed: maybe we should keep only randrange() and drop the confusing randint()?
It's actually not very large, because most of the implementation is elsewhere (e.g. the random module).
Is there something else the PEP should include? Any other requested functions? There have been a few functions suggested that were requested, e.g. password generation.
-- --Guido van Rossum (python.org/~guido)