Assignment Versus Equality

Chris Angelico rosuav at
Wed Jun 29 09:35:57 EDT 2016

On Wed, Jun 29, 2016 at 11:24 PM, BartC <bc at> wrote:
> I used this little benchmark:
> def fn():
>     n=0
>     for i in range(1000000):
>         n+=i
> for k in range(100):
>     fn()

Add, up the top:

try: range = xrange
except NameError: pass

Otherwise, your Py2 tests are constructing a million-element list,
which is a little unfair.


More information about the Python-list mailing list