How do I create an array of functions?

Diez B. Roggisch deets at nospam.web.de
Mon Feb 19 03:11:10 EST 2007


Steven W. Orr schrieb:
> I have a table of integers and each time I look up a value from the 
> table I want to call a function using the table entry as an index into 
> an array whose values are the different functions.  I haven't seen 
> anything on how to do this in python.

def f():
    pass

fmap = { key: f }


fmap[key]()


Diez



More information about the Python-list mailing list