Steve Lianoglou wrote:
> One thing you could do is use the eval or compile methods. These
> functions let you run arbitray code passed into them as a string.
>
> So, for instance, you can write:
> my_list = eval('[1,2,3,4]')
This is just asking for trouble.
my_list = eval('import shutil; shutil.rmtree('/')')
Terry's approach is much better. Another alternative is to create a
dictionary mapping an action name to a function. Basically the same as
Terry's solution, but the dictionary lookup is explicit (as opposed to
being hidden as method names).
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list