[issue5986] Avoid reversed() in Random.shuffle()

Raymond Hettinger report at bugs.python.org
Mon May 11 09:44:25 CEST 2009


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

FWIW, the inefficiency is only in the loop setup, the time to call
reversed() and __reversed__().  The inner loop runs at the same speed
because xrange provides a __reversed__ iterator.

Please do not go through the standard library making these minor tweaks
without making sure there is a significant measured speed-up and do
consider the readability issue.

----------
resolution:  -> rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5986>
_______________________________________


More information about the Python-bugs-list mailing list