title: Pass Arguments from Function to Class Method
body: <p>I think this is programming 101, but the class I missed:</p>
  
  <p>I have a class where roughly 50 default arguments are passed to <strong>init</strong>. The user can then provide different values for those arguments at the time of construction, or they can modify the resulting attributes in the normal way.</p>
  
  <p>What I would like to do is create a function, probably outside of that class that allows the user to create multiple versions of the class, and then return useful information. However, each iteration of the class in the function will have different arguments for the constructor. </p>
  
  <p>How best to allow the user of the function to supply arguments to the function that get passed on to the class constructor. </p>
  
  <p>Here is what I am trying to achieve:</p>
  
  <pre><code>class someClass(object):
      def __init__(self, a=None, b=None, c=None, d=None, e=None):
          self.a = a
          self.b = b
          self.c = c
          self.d = d
          self.e = e
  
      def some_method(self):
          # do something
          return # something useful
  
  simulations = {'1': {'a':3, 'e':6},
                 '2': {'b':2, 'c':1}}
  
  def func(simulations=simulations):
      results = []
      for sim in simulations.keys():
          sc = someClass(simulations[sim]) # use the arguments in the dict to pass to constructor
          results.append(sc.some_method())
      return results
  </code></pre>