a simple 'else' decrease speed by 1000 times.

husam h.jehadalwan at student.kun.nl
Sat Mar 2 09:44:05 EST 2002


Chris Liechti wrote:

> husam <h.jehadalwan at student.kun.nl> wrote in news:3C80BBAC.2060600
> @student.kun.nl:
> 
>>One else statement decrease speed by 1000 times. Why is that?
>>
> ...
> 
>>                           if prv == n[i][-1]:
>>                                n[i].append(new)
>>                                print count, '\t', i , '\t',n[i]
>>                                count = count +1
>>                                break
>>                           else:
>>                                n[i].append(0)
>>
> 
> 'cause your not "break"-ing here? but you do in the "if-then" part...


It should not break here. Because imagin that the matching 'prv' is 
somewhere in a line in the middle of the file, the code will break 
immediately at the first non-matching line.




More information about the Python-list mailing list