Re: is for reliable?



In <BmL%h.781$%k.3759@xxxxxxxxxxxxxxxxxx>, pabloski@xxxxxxxxxxxxxxxxx
wrote:

Hi to all I have a question about the for statement of python. I have the
following piece of code where cachefilesSet is a set that contains the
names of 1398 html files cached on my hard disk

[snipped code]

this code stops at the 473th file instead of reaching 1398

however I changed the for and substituted it with a while in this way

while cachefilesSet:
fn = cachefilesSet.pop()
.......
.......

the while loop reaches the 1398th file and is some 3-4 times faster than
the for loop

How is this possible?

Good question. ``for`` loops are of course reliable. Can you give a
short self contained example that shows the behavior?

Ciao,
Marc 'BlackJack' Rintsch
.



Relevant Pages

  • Re: is for reliable?
    ... | Hi to all I have a question about the for statement of python. ... | following piece of code where cachefilesSet is a set that contains the ... | the while loop reaches the 1398th file and is some 3-4 times faster than ...
    (comp.lang.python)
  • is for reliable?
    ... Hi to all I have a question about the for statement of python. ... following piece of code where cachefilesSet is a set that contains the ... the while loop reaches the 1398th file and is some 3-4 times faster than ...
    (comp.lang.python)
  • Re: is for reliable?
    ... following piece of code where cachefilesSet is a set that contains the ... names of 1398 html files cached on my hard disk ... The string method "strip" treats its string argument as a ...
    (comp.lang.python)