Nov-25-2019, 04:14 PM
(Nov-25-2019, 04:07 PM)DeaD_EyE Wrote: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')Since Python 3.8 we have:
Output:{'name': 'Bar', 'age': 1, 'color': 'green'}
- positional only arguments (this is new)
- arguments
- keyword-arguments
Thank you for your reply, I am on python 3.7. Isn't python 3.8 in beta?
I need to work with 3.7 due to a restriction on the device I am working on.