This has been a source of confusion and frustration for years now. Say you import a particularly poorly documented module and some method that you need to you only has **kwargs for its arguments, how are you supposed to know what keys that method is checking for?
def test(**kwargs):
if 'greeting' in kwargs:
print(kwargs['greeting'])
If i were to call text, how would i know that 'greeting is something the method was looking for?
test(greeting='hi)
Some simplistic cases the IDE can help out with, but most use cases seem to be out of the IDE's scope
Think of kwargs
as a dictionary. There is no way to tell from the outside what key-value combinations the method will accept (in your case the test
method is essentially a black box) but this is the point of having documentation. Without kwargs, some function headers would get extremely cluttered.