There are a lot of *args, **kwargs signatures in the API. In many cases, they could be better described by explicit arguments/kw-arguments. This makes for a more clear API and reduces the chance of unintended misuse.
For example pyplot.delaxes
def delaxes(*args):
"""..."""
if not len(args):
ax = gca()
else:
ax = args[0]
...
would be more clear with
def delaxes(ax=None):
"""..."""
if ax is None:
ax = gca()
...
For all intended uses, the API compatibility is preserved. Unreasonable and possibly wrong uses like
delaxes(ax1, ax2) or delaxes(ax, mykwarg=True) would raise an Exception after the change. In itself, this is a benefit, because these cases will then be detected as false usage. However it may break existing programs.
Before I do any pull requests, is there a policy how to handle such cases?
- Do you want to change these things, or should they be left as they are:
- for cases like the above one where arguments are directly resolved in the function/method?
- for cases where the all the arguments are passed like e.g.
pyplot.savefig?
- Which branch should changes go into?
There are a lot of
*args, **kwargssignatures in the API. In many cases, they could be better described by explicit arguments/kw-arguments. This makes for a more clear API and reduces the chance of unintended misuse.For example pyplot.delaxes
would be more clear with
For all intended uses, the API compatibility is preserved. Unreasonable and possibly wrong uses like
delaxes(ax1, ax2)ordelaxes(ax, mykwarg=True)would raise an Exception after the change. In itself, this is a benefit, because these cases will then be detected as false usage. However it may break existing programs.Before I do any pull requests, is there a policy how to handle such cases?
pyplot.savefig?