title: Multiple initialisation with given input parameter
body: <p>I am trying to make my class to be executed a given number of times according to passed parameter. My class converts dictionary into some desired data. </p>
  
  <p>Let me show You a quick example of what i mean exactly:</p>
  
  <p>First class <code>A</code> just offers common methods for derivative classes.
  </p>
  
  <pre><code>class A(object):
      @staticmethod
      def do_magic(obj):
      # ...
      print(''.obj)
  </code></pre>
  
  <p></p>
  
  <p>Class <code>B</code>, <code>E</code> (skipped in example) initialise objects and provide <code>b_stuff</code> and <code>e_stuff</code>.
  </p>
  
  <pre><code>class B(A):
      def __init__(self, mydict):
      #
      self.b_stuff = [...]
  </code></pre>
  
  <p></p>
  
  <p>Now Class <code>C</code> comes into play. It basically transforms given dictionary <code>mydict</code> which has a key-value pair describing number of iterations <code>'iters': 'val'</code></p>
  
  <p></p>
  
  <pre><code>class C(B, E):
      def __init__(self, mydict):
          B.__init__(self, mydict) # access to b_stuff
          E.__init__(self, mydict) # access to e_stuff
  
          self.iters = int(self.mydict['iters'])     # desired nb of initialisations/executions
          self.c_stuff = [b_stuff, e_stuff, other]        
  
      def do_magic(self):
          A.do_magic(self.c_stuff) 
  </code></pre>
  
  <p></p>
  
  <p>Now the problem is, that once calling a class from external loop later in code i don't know how to make my class to <code>do_magic</code> <code>mydict['iters']</code> number of times.  </p>
  
  <p></p>
  
  <pre><code>for d in list_of_dicts:
      C(d).do_magic()
  </code></pre>
  
  <p></p>
  
  <p>One of solutions could be that i'll initialise this class just in external loop above, like that: </p>
  
  <p></p>
  
  <pre><code>for d in list_of_dicts:
      for i in range(int(d['iters']))
          C(d).do_magic()
  </code></pre>
  
  <p></p>
  
  <p>But it feels far away from OOP style. </p>
  
  <p>To be 100% sure that You folks follow me, ill show here actual expected behaviour:
  <br>
  <code>d</code> - input dictionary<br>
  <code>d['iters'] = 2</code><br></p>
  
  <p><strong>Execute</strong></p>
  
  <pre><code>C(d).do_magic()
  </code></pre>
  
  <p><strong>Actual result:</strong></p>
  
  <pre><code>&gt;&gt;&gt; 
  'XXX YYY RANDOM_NUMBER1 .... '  
  </code></pre>
  
  <p><strong>Expected result:</strong></p>
  
  <pre><code>&gt;&gt;&gt; 
  'XXX YYY RANDOM_NUMBER1 .... '  
  'XXX YYY RANDOM_NUMBER2 .... '  # random number from class B re-initialised!!
  </code></pre>
  
  <p>As exploring stack i've found out some hints to refer <code>__new__</code> method but still no clue if this is a right path and how :) </p>
  
  <p><strong>Edit</strong>:</p>
  
  <p>As @Peter-wood suggested - adding to a question: </p>
  
  <p>I'd like to point out that both attributes <code>b_stuff</code> and <code>e_stuff</code> once initialised - produce <strong>unique strings</strong> that are part of <code>c_stuff</code> and are about to be updated with each <code>do_magic()</code> call. </p>
  
  <p>This method basically does <code>''.join(obj)</code> (see class A)</p>