add extra value to kwarg list
<p>Suppose there is the following external module and its spelled out like this:</p>

<p><strong>module1.py</strong></p>

<pre><code>X = [1,2,3]

def test_func(keyword_list=X):
    return keyword_list

test_func()
</code></pre>

<p>In another file I am trying to add another item to the kwarg <code>X</code> where ill be making my call and that will be here:</p>

<p><strong>my_file.py</strong></p>

<pre><code>from module1 import test_func

test_func()
...
</code></pre>

<p>Is there any way concise way of adding an extra list item to my kwarg in my initial call to <code>test_func</code>. I know technically I could something like the following:</p>

<pre><code>from module1 import test_func, X

test_func(keyword_list=X + [4])

[1,2,3,4]
</code></pre>

<p>Is there anyway to do this without importing <code>X</code> directly from <code>module1.py</code>?</p>

<p><strong>Edit</strong> <code>module1.py</code> is an open source module that I can't directly change.</p>

<p>It seems one way to enable the scenario would be to have your test_func api take two lists...</p>

<pre><code>def test_func(user_keywords=None, default_keywords=X):
    # merge them
    # more stuff...
</code></pre>

<p>I am sure there are ways to reflect over the method and get the default args using the <code>inspect</code> module and methods such as <code>inspect.getargspec</code> but that seems like a hassle that can be avoided by accommodating intended use cases in the method signature in the first place.</p>

python