Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> writes: > The most conservative approach is to assume that while you're suspended, > *everything else* is suspended too, so when you resume you still have to > sleep for the full N seconds.
That's an intriguing interpretation of what sleep() should do, but I fail to see *how* the function could even attempt to do that: should it keep its own notion of the elapsed time? I mean, one simplicistic, naive (and wrong) implementation of Dave's (and mine, FWIW) could be: def sleep(secs): now = time() while time() < (now + secs): pass # this is wrong, should really be some kind of "yield_cpu()" How would it become if it should take into account the intervening "coma"? Maybe something like def sleep(secs): nmillisleeps = secs * 1000 for i in range(nmillisleeps): now = time() while time() < (now + 0.001): pass ? Also, should it also assume that if the system suffers of a slowdown instead (maybe simply due to another process using the same /inefficient and wrong/ implementation of sleep() ;-) then everything else gets slowed down too, and act accordingly? just-for-the-sake-of-arguing-ly, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- https://mail.python.org/mailman/listinfo/python-list