On Sat, Jun 28, 2014 at 11:41 PM, Dennis Lee Bieber
<wlfr...@ix.netcom.com> wrote:
> On Fri, 27 Jun 2014 12:06:54 +1000, Chris Angelico <ros...@gmail.com>
> declaimed the following:
>
>>
>>If x is, say, range(1000000), a simple "for foo in x: pass" will
>>complete fairly quickly (maybe 100ms on my computer), while the
>>progress-indicated loop will take much longer (about 30 seconds when I
>>tried it). Obviously you'll be doing more work than just "pass", but
>
>         I take it those are subjective feelings of time...

No, they were measured; but the exact difference will depend on Python
version, console, OS, etc, etc, etc, etc, etc, which is why I said
"maybe 100ms" - on one run it was about that (rounded aggressively to
make for convenient figures), but if I ran the test again, it might
come out at 50ms or 200ms. For what it's worth, I did the test on
Python 3.5(ish) on Linux; since you tested it on Python 2, a closer
comparison would be to use xrange rather than range, to avoid the RAM
overhead.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to