> Thanks alot Jeff. This worked for me:
> 
> formhandlers={}
> for verb,verb_desc in PROVISION_ACTIONS:
> try:
> formhandlers[verb]=globals()[verb]
> except KeyError:
> pass


I'm slightly confused about why you need to do this?
You create a list of names (PROVISION_ACTIONS), then 
you add the corresponding functions to a dictionary 
by looking the names up in the globals dictionary. 
But since uyou know the names of the functions why 
not just add them to the actions list in the first place?

PROVISION_ACTIONS = [('foo',foo),('bar',bar)]

formhandlers = {}
for name,action in PROVISION_ACTIONS:
   formhandlers[name] = action

Or even easier do it all in one step:

formhandlers = { 'foo':foo,
                 'bar',bar,
                 etc...
               }

Why do you need the globals lookup when you know the 
names of the functions already?

I'm missing something...

Alan G.
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to