[Tutor] How to put my functions in an array

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Sun Jan 2 08:43:13 CET 2005



On Sat, 1 Jan 2005, Jacob S. wrote:

> funct = {'Add Virt':addvirt,'Remove Virt':remvirt,'More
>           Stuff':more,"Extras":extra}
> def addvirt():
>     pass
> def remvirt():
>     pass
> def more():
>     pass


Hi Jacob,

Quick gotcha note: the definition of the 'funct' dictionary has to go
after the defintion of the hander functions: otherwise, Python has no clue
what 'addvirt' and 'remvirt' are.  Don't worry: it happens to me too.
*grin*


Hope this helps!



More information about the Tutor mailing list