title: Calling a Python function with *args,**kwargs and optional / default arguments
body: <p>In Python I can define a function as follows:</p>
  <pre class="lang-py prettyprint-override"><code>def func(kw1=None,kw2=None,**kwargs):
     ...
  </code></pre>
  <p>In this case, I can call <code>func</code> as:</p>
  <pre class="lang-py prettyprint-override"><code>func(kw1=3,kw2=4,who_knows_if_this_will_be_used=7,more_kwargs=Ellipsis)
  </code></pre>
  <p>I can also define a function as:</p>
  <pre class="lang-py prettyprint-override"><code>def func(arg1,arg2,*args):
      ...
  </code></pre>
  <p>which can be called as</p>
  <pre class="lang-py prettyprint-override"><code>func(3,4,additional,arguments,go,here,Ellipsis)
  </code></pre>
  <p>Finally, I can combine the two forms</p>
  <pre class="lang-py prettyprint-override"><code>def func(arg1,arg2,*args,**kwargs):
      ...
  </code></pre>
  <p>But, what does not work is calling:</p>
  <pre class="lang-py prettyprint-override"><code>func(arg1,arg2,*args,kw1=None,kw2=None,**kwargs):  #SYNTAX ERROR (in Python 2 only, apparently this works in Python 3)
      ...
  </code></pre>
  <p>My original thought was that this was probably because a function</p>
  <pre class="lang-py prettyprint-override"><code>def func(arg1,arg2,*args,kw1=None):
      ...
  </code></pre>
  <p>can be called as</p>
  <pre class="lang-py prettyprint-override"><code>func(1,2,3)  #kw1 will be assigned 3
  </code></pre>
  <p>So this would introduce some ambiguity as to whether 3 should be packed into <code>args</code> or <code>kwargs</code>. However, with Python 3, there is the ability to specify keyword only arguments:</p>
  <pre class="lang-py prettyprint-override"><code>def func(a,b,*,kw=None):  # can be called as func(1,2), func(1,2,kw=3), but NOT func(1,2,3)
      ...
  </code></pre>
  <p>With this, it seems that there is no syntactic ambiguity with:</p>
  <pre class="lang-py prettyprint-override"><code>def func(a,b,*args,*,kw1=None,**kwargs):
      ...
  </code></pre>
  <p>However, this still brings up a syntax error (tested with Python3.2).  Is there a reason for this that I am missing? And, is there a way to get the behavior I described above (Having <code>*args</code> with default arguments) -- I know I can simulate that behavior by manipulating the <code>kwargs</code> dictionary inside the function.</p>