Why doesn't time.sleep run in parallel in a Tornado coroutine?

Viewed 498

When I run this handler in a simple Tornado app and make two requests to it with curl, it doesn't run in parallel. It prints out "1 2 3 4 5 1 2 3 4 5", when I want it to print "1 1 2 2 3 3 4 4 5 5".

class SleepHandler(RequestHandler):
    def get(self):
        for i in range(5):
            print(i)
            time.sleep(1)

What am I doing wrong?

1 Answers
Related