kwargs reserved word in python. What does it mean?
This question already has an answer here:
**kwargs
means keyword arguments. Its actually not a python keyword, its just a convention, that people follow. That will get all the key-value parameters passed to the function. For example,
def func(*args, **kwargs):
print args, kwargs
func(1, "Welcome", name="thefourtheye", year=2013)
will print
(1, 'Welcome') {'name': 'thefourtheye', 'year': 2013}
Yes, it means "keyword arguments", but kwargs
is not actually a reserved word. It is just the idiomatic thing to call the argument that collects all the unused keyword arguments.