cpu usage limit
Peter Hansen
peter at engcorp.com
Fri May 27 18:15:49 EDT 2005
rbt wrote:
> garabik-news-2005-05 at kassiopeia.juls.savba.sk wrote:
>> finished = False
>> while not finished:
>
> Why don't you just write 'while True'??? 'while not false' is like
> saying 'I am not unemployed by Microsoft' instead of saying 'I am
> employed by Microsoft'. It's confusing, complex and unnecessary. Lawyers
> call it circumlocution (talking around the truth).
>
>> before = time.time()
>> do(x) # sets finished if all was computed
>> after = time.time()
>> delta = after-before
>> time.sleep(delta*10/3.)
The answer to your question "why not write 'while True'?" is to be found
in the helpful comment he put on the line with "do(x)".... Note that
"finished" is a flag, so "sets finished" sort of explains the whole thing.
-Peter
More information about the Python-list
mailing list