Deferring a function call
- From: TomF <tomf.sessile@xxxxxxxxx>
- Date: Mon, 18 Oct 2010 21:21:41 -0700
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 [[TIME, FN, ARGS]...] and at simulated time TIME do: apply(FN, ARGS)
Aside from the fact that apply is deprecated, it seems like there should be a cleaner (possibly more Pythonic) way to do this. Ideas?
-Tom
.
- Follow-Ups:
- Re: Deferring a function call
- From: Werner Thie
- Re: Deferring a function call
- From: Peter Otten
- Re: Deferring a function call
- From: Michael Ricordeau
- Re: Deferring a function call
- From: Lawrence D'Oliveiro
- Re: Deferring a function call
- From: Steven D'Aprano
- Re: Deferring a function call
- From: Chris Rebert
- Re: Deferring a function call
- From: Chris Rebert
- Re: Deferring a function call
- Prev by Date: Re: Classes in a class: how to access variables from one in another
- Next by Date: Re: Classes in a class: how to access variables from one in another
- Previous by thread: Learning with Open Source Applications.
- Next by thread: Re: Deferring a function call
- Index(es):
Relevant Pages
|