title: Dealing with many parameters/class attributes in Python
body: <p>I'm creating a Python class that will use its parameters to define two other classes within this class. For example, <code>ClassA</code> contains <code>ClassB</code> and <code>ClassC</code>. Because of this, ClassA has a lot of parameters.</p>
  <p>I'm currently solving this using <code>**kwargs</code> for <code>classB</code> and <code>classC</code> arguments, and saving only the input parameters for <code>classA</code> parameters. For example:</p>
  <pre><code>class A:
      def __init__(self, a1, a2, a3, **kwargs):
          self.a1 = a1
          self.a2 = a2
          self.a3 = a3
  
          # Get B and C kwargs
          default_params = {
              'b1': kwargs.get('b1', 1),
              'b2': kwargs.get('b1', 2),
              'c1': kwargs.get('c1', 1),
              'c2': kwargs.get('c1', 2),          
          }
          for param in default_params:
              self.__dict__[param] = default_params[param]
  
          B = classB(a1=self.a1, b1=self.b1, b2=self.b2)
          C = classC(a2=self.a2, c1=self.c1, c2=self.c2)
  
  </code></pre>
  <p>Is this a worse solution compared to the below?</p>
  <pre><code>class A:
      def __init__(
          self,
          a1, a2, a3,
          b1, b2, c1, c2):
          self.a1 = a1
          self.a2 = a2
          self.a3 = a3
          self.b1 = b1
          self.b2 = b2
          self.c1 = c1
          self.c2 = c2
  </code></pre>
  <p>My concern is if arguments for class B and C are super numerous, then class A's attributes seems too many. On the other hand, the first approach seems to take up more lines anyway.</p>
  <p>Another way is if I pass only kwargs to <code>classB</code> and <code>classC</code>, but this will have an error when there are some parameters not present in one of the classes.</p>
  <p>Is there a pythonic way I'm failing to see here for classes with many attributes and utilising this kind of design pattern?</p>