Message314455
| Author |
wolma |
| Recipients |
rhettinger, wolma |
| Date |
2018年03月26日.15:00:28 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1522076428.25.0.467229070634.issue33144@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2018年03月26日 15:00:28 | wolma | set | recipients:
+ wolma, rhettinger |
| 2018年03月26日 15:00:28 | wolma | set | messageid: <1522076428.25.0.467229070634.issue33144@psf.upfronthosting.co.za> |
| 2018年03月26日 15:00:28 | wolma | link | issue33144 messages |
| 2018年03月26日 15:00:28 | wolma | create |
|