Re: Python Pseudo-Switch

2005-05-09 Thread Jason Mobarak
# -*- python -*- import sys def switchFor (target): sw = '__switch_table__' # please pretend the frame hack is not here, # it happens to work for classes and messing with # frame stack in a try/except is probably okay try: raise Exception() except: defs =

Re: Python Pseudo-Switch

2005-05-07 Thread Jason Mobarak
James Stroud wrote: > Hello All, > > Because of my poorly designing a database, I have recently found it necessary > to explore the wonders of the Python pseudo-switch: > > do_case = { "A" : lambda x: x["bob"], > "B" : lambd

Re: Python Pseudo-Switch

2005-05-07 Thread Dan Bishop
James Stroud wrote: > Hello All, > > Because of my poorly designing a database, I have recently found it necessary > to explore the wonders of the Python pseudo-switch: > > do_case = { "A" : lambda x: x["bob"], > "B" : lambd

Re: Python Pseudo-Switch

2005-05-07 Thread Terry Reedy
"James Stroud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Because of my poorly designing a database, I have recently found it > necessary > to explore the wonders of the Python pseudo-switch: > > do_case = { "A" : lambda x: x[&quo

Python Pseudo-Switch

2005-05-07 Thread James Stroud
Hello All, Because of my poorly designing a database, I have recently found it necessary to explore the wonders of the Python pseudo-switch: do_case = { "A" : lambda x: x["bob"], "B" : lambda x: x["carol"], "C" : lambda