For me nothing beats using twisted ( http://www.twistedmatrix.com ) with
its clean implementation of deferreds and a host of other useful things
for simulations besides being the 'Swiss Army Knife' of networking in
Python. If you throw in stackless ( http://www.stackless.com )
simulations with
Thanks for the ideas, everyone.
functools.partial and lambda expressions seem like a more pythonic way
of doing what I want. I don't know whether they're actually more
efficient or better, but at least they eliminate the need to carry args
around separately.
I'd forgotten Python has a sched
TomF wrote:
> I'm writing a simple simulator, and I want to schedule an action to
> occur at a later time. Basically, at some later point I want to call a
> function f(a, b, c). But the values of a, b and c are determined at
> the current time.
>
> One way way to do this is to keep a list of en
For scheduling, I use eventlet package and spawn_after_local .
http://eventlet.net
But you must be aware of the constraints like using "monkey patched" modules .
Le Mon, 18 Oct 2010 21:21:41 -0700,
TomF a écrit :
> I'm writing a simple simulator, and I want to schedule an action to
> occ
On 19Oct2010 04:59, Steven D'Aprano
wrote:
| Chris Rebert has already mentioned the sched module. Otherwise, put the
| function call in a thread, and have the thread use time.sleep to wait
| until the right time to execute.
There is also the Timer class from the threading module.
Cheers,
--
In message <2010101821214168010-tomfsess...@gmailcom>, TomF wrote:
> One way way to do this is to keep a list of entries of the form [[TIME,
> FN, ARGS]...] and at simulated time TIME do:
fn(*args) or fn(**kwargs)
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 18 Oct 2010 21:21:41 -0700, TomF wrote:
> I'm writing a simple simulator, and I want to schedule an action to
> occur at a later time. Basically, at some later point I want to call a
> function f(a, b, c). But the values of a, b and c are determined at the
> current time.
>
> One way wa
On Mon, Oct 18, 2010 at 9:21 PM, TomF wrote:
> I'm writing a simple simulator, and I want to schedule an action to occur at
> a later time. Basically, at some later point I want to call a function f(a,
> b, c). But the values of a, b and c are determined at the current time.
See the `sched` std
I'm writing a simple simulator, and I want to schedule an action to
occur at a later time. Basically, at some later point I want to call a
function f(a, b, c). But the values of a, b and c are determined at
the current time.
One way way to do this is to keep a list of entries of the form [[T