헉.

http://mail.python.org/pipermail/python-list/2003-May/204090.html

Just to make sure that everyone else can get some benefit from my self-induced pain:

I have wasted a bit of time recently, wondering why Python doesn’t offer a usleep() (sleep for microseconds) function. I had found the time module, and used its time.sleep(), but was frustrated that it didn’t have a time.usleep() as well. After searching the web and the newsgroup archives, I finally figured I might get stuck implementing something like this at a low level. After all that, I was just reading a recent post reminding about the dangers of explicit type-checking reducing polymorphism, and somehow that reminded me of my problem. I had been assuming (courtesy of my strongly-typed background) that time.sleep() took in integer argument, but in fact it takes any numerical argument, so that:

time.sleep(0.000001)

works just fine, and apparently perfectly.

Tags:

Leave a comment