On Sat, 16 Jun 2012 13:27:45 -0400 Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote:
> On Sat, 16 Jun 2012 20:01:12 +1000, John O'Hagan > <resea...@johnohagan.com> declaimed the following in > gmane.comp.python.general: > > > > > That looks like a possible way to do all the streams in a single thread, > > although it works a little differently from your outline above if I > > understand you correctly, in that only the events know their start times > > and they are produced by iterators which can be modified on the fly and > > which can be added and removed from the overall process at any time, so > > it's not possible to know in advance which iterator will produce the > > chronologically next event. I think > > Which is why I mentioned processing all events at a time-point, then > iterate for the next events if any are generated -- and a "time-ordered" > (aka; priority) list, so the new events are positioned in the correct > sequence against any other events that are in it. Now I get it, I thought you meant generating all events ahead of time. > > that means that any ordered list of events would have to be re-ordered after > > each event is read. It might be worth a try though. I notice there is simpy > > for > > Not "after each event is read" but when a new event is > generated/inserted. The list is not a FIFO where new events are added to > the end, but more of a priority queue where the lowest time is the next > to be retrieved. You're right, of course. > > discrete event simulation in python. I'll look into it, thanks. > > > One major difference is that traditional discrete event simulation > uses a false clock -- the simulation time advances to the next (first > pending) event time immediately. You'd need to modify that operation to > put in a real-time clock "sleep until" effect. My events are already handled that way so that's easy - the hard part is the more complex logic required by doing it without threads. Or maybe it's just different, I'm in the process of getting my head around it; thanks for the pointers. John -- http://mail.python.org/mailman/listinfo/python-list