list of functions question

Kent Johnson kent at kentsjohnson.com
Thu Apr 27 09:02:23 EDT 2006


val bykoski wrote:
> Hi The List:
>    I have a modeling app where i'm detecting events (in temporal 
> dynamics) applying a set of (boolean) functions - kind of:
> 
> event_list = "f1 f2 etc".split()  # each fi detects a specific event
> i have defs for functions fi, or simple boolean expressions for each, so 
> that evList is a list of defs or boolean expressions
> for ev in evList:
>     if ev:	# this supposedly is a call ev(t)
>        # doing smth with the event

# Make a list of the actual functions, not their names
# For the events that are expressions, encapsulate them in functions
event_list = [f1, f2, etc]

# Call each one:
for ev in event_list:
   if ev(t):
     # do something

Kent



More information about the Python-list mailing list