Gabriel Rossetti a écrit :
Terry Reedy wrote:
(snip)
Unlike the class approach, this requires recreating the constant functions and dict with each call to _test. Quick to write but a bit 'dirty', in my opinion. Another standard idiom is to set up the constants outside the function:def request(params): pass def submit(params, values): pass def update(params, values): pass def delete(params): passdispatch = {'request':request, 'submit':submit, 'update':update, 'delete':delete}def _test(self, action, *args): return resultToXmo(dispatch[action](*args))That's how I had done it originally (before the use of eval()), but in this case also, since the functions are still nested,
Uh ??? You probably want to re-read the above code snippet. -- http://mail.python.org/mailman/listinfo/python-list
