It refers to all keyword arguments passed to a function that is not part of the method definition. For example:
>>> def foo(arg, **kwargs): ... print kwargs ... >>> foo('a', b="2", c="3", bar="bar") {'c': '3', 'b': '2', 'bar': 'bar'}
This is similar to using only one asterisk, which refers to all arguments without a keyword:
>>> def bar(arg, *args): ... print args ... >>> bar(1, 2, 3, 'a', 'b') (2, 3, 'a', 'b')
You can combine these (and people often)
>>> def foobar(*args, **kwargs): ... print args ... print kwargs ... >>> foobar(1, 2, a='3', spam='eggs') (1, 2) {'a': '3', 'spam': 'eggs'}
Nolen Royalty
source share