Reputation: 3727
What's the best way to understand which **kwargs are valid for a given python function?
I often need to use python functions that can accept additional keyword arguments as **kwargs, but I am unsure which **kwargs I can use.
For example, I am currently looking at the matplotlib.pyplot.subplot2grid function docs https://matplotlib.org/3.2.1/api/_as_gen/matplotlib.pyplot.subplot2grid.html but it doesn't give any further information.
Upvotes: 1
Views: 286
Reputation: 42492
It really depends on the specifics of the function, if it's not documented there's not much you can do short of diving through the code.
Here, the documentation does tell you:
Additional keyword arguments are handed to
add_subplot
.
So you can look at the documentation for add_subplot and see what kwargs are likely acceptable.
Upvotes: 2