Passing on named variable arguments in python
<p>Say I have the following methods:</p>

<pre><code>def methodA(arg, **kwargs):
    pass

def methodB(arg, *args, **kwargs):
    pass
</code></pre>

<p>In methodA I wish to call methodB, passing on the kwargs. However, it seems that if I define <code>methodA</code> as follows, the second argument will be passed on as positional rather than named variable arguments.</p>

<pre><code>def methodA(arg, **kwargs):
    methodB("argvalue", kwargs)
</code></pre>

<p>How do I make sure that the **kwargs in methodA gets passed as **kwargs to methodB?</p>

<p>Put the asterisks before the kwargs variable. This makes Python pass the variable (which is assumed to be a dictionary) as keyword arguments.</p>

<pre><code>methodB("argvalue", **kwargs)
</code></pre>
