Message314835
| 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:36 | selik | set | recipients:
+ selik, rhettinger, serhiy.storchaka, wolma |
| 2018年04月02日 22:33:36 | selik | set | messageid: <1522708416.49.0.467229070634.issue33203@psf.upfronthosting.co.za> |
| 2018年04月02日 22:33:36 | selik | link | issue33203 messages |
| 2018年04月02日 22:33:36 | selik | create |
|