Tim Peters <t...@python.org> added the comment:

I don't see anything objectionable about the class optimizing the 
implementation of a private method.

I'll note that there's a speed benefit beyond just removing the two type checks 
in the common case:  the optimized `_randbelow()` also avoids populating its 
locals with 5 unused formal arguments (which are just "a trick" to change what 
would otherwise have been global accesses into local accesses).  So it actually 
makes the method implementation cleaner & clearer too.

But it's really the speed that matters here.

----------

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

Reply via email to