[issue20583] Hide underscored parameters

Yury Selivanov report at bugs.python.org
Mon Feb 10 23:17:37 CET 2014


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 <report at bugs.python.org>
<http://bugs.python.org/issue20583>
_______________________________________


More information about the Python-bugs-list mailing list