Yury Selivanov added the comment:

> 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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20583>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to