Possible with hasmethod (not applicable), but this isn’t good practice. A particular call site doesn’t specify a method; method dispatch is handled for you as you provide various positional arguments. While different methods can have different keyword arguments, it’s good practice to keep the applicable keyword arguments consistent over interchangeable positional argument types or sometimes over a change in the function itself, like a plotting package’s functions sharing keyword arguments for graphics settings. You could add a keyword argument for all methods where a particular positional argument is narrowed down, like dims for AbstractArrays, but you wouldn’t use dims in calls that may interchange either Numbers or Arrays for that argument. You should mostly rely on consistent keyword argument applicability, then use hasmethod or handle MethodErrors as a last resort.
1 Like