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.

Author yselivanov
Recipients georg.brandl, ncoghlan, r.david.murray, serhiy.storchaka, yselivanov
Date 2014-02-10.22:17:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1392070657.12.0.132265039133.issue20583@psf.upfronthosting.co.za>
In-reply-to
Content
> Yury: it's a micro-optimization, the slow builtin lookup becomes a fast local lookup.

That's what I thought, thank you.
I think we should discourage use of this pattern (at least in the stdlib). There is small to no performance benefit to do that.

And if it's absolutely required to optimize the hell out of function, it's much better to just create a protected module attribute:

_int = int

That way, there is almost no performance difference between _int in the signature, and _int as a module global.
History
Date User Action Args
2014-02-10 22:17:37yselivanovsetrecipients: + yselivanov, georg.brandl, ncoghlan, r.david.murray, serhiy.storchaka
2014-02-10 22:17:37yselivanovsetmessageid: <1392070657.12.0.132265039133.issue20583@psf.upfronthosting.co.za>
2014-02-10 22:17:37yselivanovlinkissue20583 messages
2014-02-10 22:17:36yselivanovcreate