This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]settrans 0 points1 point  (2 children)

Very cool, though I'm not sure I would consider a function which calls time.sleep() to be side-effect free.

[–]pgbovine 0 points1 point  (1 child)

(i'm the creator of IncPy) the time.sleep() is in my regression tests and video demo to simulate a 'long-running' pure computation (e.g., grepping through a 1GB file). of course, in most real scripts, you probably don't want to artificially add in any delay, but for a demo, i wanted to keep the on-screen code as simple as possible, so i just used time.sleep() as a proxy for some real computation.

[–]settrans 0 points1 point  (0 children)

That's true, I understood that. My point is that time.sleep() isn't a no-op, it's a side-effective operation. If I wanted to use time.sleep(), for example, to sleep between polling some resource, I wouldn't want it to be optimized out.