Quote:What is kwargs in your snippet?
kwargs
is just a name used by convention for keyword-arguments.The
**
in front the name is important.Then all keyword-arguments, which are left over, are mapped into a dict.
def foo(**kwargs): print(kwargs) foo(name='Bar', age=1, color='green')
Output:{'name': 'Bar', 'age': 1, 'color': 'green'}
Since Python 3.8 we have:- positional only arguments (this is new)
- arguments
- keyword-arguments
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!