Perspective, time.sleep vs

Hi all,

So what would be better, time.sleep or, on Perspective View. ( 8.0.13 and after)
a. for 1-3 seconds
b. for longer period, minutes, days etc

Thanks for your insight.

time.sleep should be avoided in basically every scenario - the only exception I would maybe give is a dedicated thread spawned by invokeAsynchronous. technically hooks into an internal class, but the signature of that class is pretty unlikely to change, and, crucially, it does not require a thread to be kept sleeping.


I’m naturally biased, as the author of But see my rants on people using sleep():


So in Perspective no invokeLater, noTimer, only time.sleep which should be avoided.

For the moment all we can say is Long Live Phil. :slight_smile:

1 Like

In an event-driven environment, I see use of sleep() as an indication that there’s a state machine that needs to be written, with regular timer calls to step it along.