Author selik
Recipients rhettinger, selik, serhiy.storchaka, wolma
Date 2018-04-02.22:33:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1522708416.49.0.467229070634.issue33203@psf.upfronthosting.co.za>
In-reply-to
Content
If you're going to tackle this problem, this should probably be solved for the general case of n <= 0 rather than just n == 0.

In [1]: import random

In [2]: class Random(random.Random):
   ...:     def random(self):
   ...:         return  super().random()
   ...:

In [3]: r = Random()

In [4]: r._randbelow(-1) # Should raise a ValueError
Out[4]: 0

But honestly, if someone is going to override ``random`` I think we can expect them to realize they're stepping into the deep end.
History
Date User Action Args
2018-04-02 22:33:36seliksetrecipients: + selik, rhettinger, serhiy.storchaka, wolma
2018-04-02 22:33:36seliksetmessageid: <1522708416.49.0.467229070634.issue33203@psf.upfronthosting.co.za>
2018-04-02 22:33:36seliklinkissue33203 messages
2018-04-02 22:33:36selikcreate