Factory pattern implementation in Python
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Mon Dec 4 15:15:27 EST 2006
Dennis Lee Bieber:
> Presuming the <event x> is a type code I'd just set up a list of functions:
> Then create a dictionary of them, keyed by the <event x> code
> processors = { "1" : process_1,
> "2" : process_2,
> ....
> "x" : process_x }
Just a dict of functions was my solution too, I think avoiding more
complex solutions is positive.
Bye,
bearophile
More information about the Python-list
mailing list