sokol wrote:
Also, the scheduler runs inside a loop. How do you suppose to run other code while the loop is executing?
The sleep function could be doing a select with a timeout on some other source of events, such as a socket or a gui input event stream. One possible response to such an event is to schedule another event. There's not so much need for that nowadays, since most gui libraries provide a way of scheduling timed events as part of their built-in event loop, but you might want to use something like this in a server that deals with network connections. Another possible use is discrete-event simulation, where the "sleep" function doesn't physically sleep but just advances a simulated time, and all events (other than the first one that starts everything off) are scheduled by callbacks for other events. So while its uses are rather specialized, I wouldn't say it's useless. The main problem is that its nature needs to be much more clearly spelled out in the docs -- it's something of an attractive nuisance the way it is. -- Greg -- http://mail.python.org/mailman/listinfo/python-list