On 4/12/2019 4:00 PM, Anders Hovmöller wrote:
On 12 Apr 2019, at 19:16, Eric V. Smith <e...@trueblade.com> wrote:
I don't want to speak for the OP, but I have a similar use case (which is why I
wrote calllib). My use case is: I have number of callables that I don't
control. I also have a dict of parameters that the callables might take as
parameters. I want to call one of the callables, passing only the subset of
parameters that that particular callable takes.
Could you expand on "that I don't control"? Where do these come from?
Their names come from a config file. I dynamically load them and call
them. I wrote some of them, other people wrote others. It's an internal
corporate app, and there are a lot of callables, all with different
release schedules and controlled by different teams. Over time, the
interface to these callables has expanded. First, it took just x, then a
few of them needed x and y, and others needed x and z.
I realize this isn't the greatest interface, and in an ideal world we
would have come up with a better way to specify this. But it evolved
over time, and it is what it is.
We have similar used cases in libs we've created but there we define that the
API is that you must do **_ to be compatible with future versions of the lib.
Unfortunately I don't control the interface or the source to the code
I'm calling, so the best I've been able to do is only call each function
with the parameters I know it expects, based on its signature. At least
the parameter names are well defined.
Eric
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/