Calling an arbitrary function with the right arguments
bruno.42.desthuilliers at websiteburo.invalid
Mon Sep 27 10:19:19 CEST 2010
John O'Hagan a écrit :
> How to call a function with the right arguments without knowing in advance
> which function?
For most use case I can think of, I can only second Steven and Chris -
if your functions are interchangeable then they should have a same API.
Now there's at least one use case I know where you need to dynamically
select a function then build the right arguments set for it: when
mapping urls to http request handler functions. There's a good example
in Django's url to "view" mapping system.
More information about the Python-list