➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 wolma
收信人 rhettinger, wolma
日期 2018-03-26.15:00:28
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1522076428.25.0.467229070634.issue33144@psf.upfronthosting.co.za>
In-reply-to
内容
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?
历史
日期 用户 动作 参数
2018-03-26 15:00:28wolma修改recipients: + wolma, rhettinger
2018-03-26 15:00:28wolma修改messageid: <1522076428.25.0.467229070634.issue33144@psf.upfronthosting.co.za>
2018-03-26 15:00:28wolma链接issue33144 messages
2018-03-26 15:00:28wolma创建