Brian Gladman <b...@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.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to