title: Pythonic way to pass around many arguments
body: <p>I'm working on a package that contains subpackages and several modules within each subpackage.
  Most of the functions need several arguments (~10) that are initiated in the "main" function. Usually, all the arguments are passed to methods that are called from within a function. What is the best way to pass around these parameters ?</p>
  
  <p>Consider the following scenario:</p>
  
  <pre><code>def func(arg1, arg2, ...., argn):
    do something  
    ext_method(arg1, arg3,...argk) # Note: all the arguments are not passed to ext_method
    cleanup  
  </code></pre>
  
  <p>PS:  Function nesting can go quite deep (say around 10-12 functions starting from main function). 
  I considered two alternatives:</p>
  
  <ol>
  <li><p>Inspect method: Construct a dict of all the arguments in the main function with all the arguments. To call a function: Get its argspec using the method in inspect package, and filter out unnecessary arguments from the "global" arguments dict. It looks something like the below snippet.</p>
  
  <pre><code>args = {arg1: obj1, arg2:obj2,...}  
  req_args = dict([(k, v) for k, v in args.items() if k in inspect.getargspec(ext_method).args])
  </code></pre></li>
  <li><p>key-value method: <code>ext_method()</code> is called using argument key-value pairs </p>
  
  <pre><code>ext_method(arg1=val1, arg3=val3,...,argk=valk)
  </code></pre></li>
  </ol>
  
  <p>I find the second method to be ineffective because its not easy to change the signature of <code>ext_method()</code> as more features are added to the package. Is method 1 a better alternative ?</p>