Message314455
Given that the random module goes a long way to ensure optimal performance, I was wondering why the check for a match between the random and getrandbits methods is performed per call of Random._randbelow, when it could also be done at instantiation time (the attached patch uses __init_subclass__ for that purpose and, in my hands, gives 10-25% speedups for calls to methods relying on _randbelow).
Is it really necessary to guard against someone monkey patching the methods rather than using inheritance? |
|
| Date |
User |
Action |
Args |
| 2018-03-26 15:00:28 | wolma | set | recipients:
+ wolma, rhettinger |
| 2018-03-26 15:00:28 | wolma | set | messageid: <[email protected]> |
| 2018-03-26 15:00:28 | wolma | link | issue33144 messages |
| 2018-03-26 15:00:28 | wolma | create | |
|