A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-October/141948.html below:

[Python-Dev] PEP 506 secrets module

[Python-Dev] PEP 506 secrets moduleRandom832 random832 at fastmail.com
Sat Oct 17 12:54:51 EDT 2015
Brian Gladman <brg at gladman.plus.com> writes:

>> On Sat, Oct 17, 2015 at 03:26:46AM +1100, Steven D'Aprano wrote:
> I hence support your conclusion that the module should offer randbelow
> alone.  I would oppose offering randomrange (or offering more than one
> of them) since this will pretty well guarantee that, sooner or later,
> someone will make a mistake in using the extra functionality and
> possibly deploy an insecure application as a result.
>
>    Brian Gladman

Plus if someone really does want randrange, they can simply do this:

def randfrom(seq):
    return seq[randbelow(len(seq))]

def randrange(start, stop, step=None):
    randfrom(range(start, stop, step))

These are simple recipes that probably don't belong in the module.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4