title: Dynamically creating objects from class in python
body: <p>I've looked around but have not found a topic answering my problem. If you know of one feel free to redirect me to it.</p>
  
  <p>I have two dictionaries created dynamically. [EDIT : by 'dynamically' I mean that the size of these dictionaries will vary depending on the file i fed to the program. As indicated in one of the comments, I may be misusing this word. Please forgive.]</p>
  
  <p>One contains strings of R,G,B values and looks like this :</p>
  
  <pre><code>colors = {0: ('255', '255', '255'), 1: ('255', '148', '0'), 2: ('238', '245', '0'), 3: ('255', '0', '0')}
  </code></pre>
  
  <p>The other contains index informations for those R,G,B values and looks like this :</p>
  
  <pre><code>index = {511: 0, 365: 1, 488: 2, 500:0, ...}
  </code></pre>
  
  <p>I've created a class :</p>
  
  <pre><code>class ColorArray:
      indexArray = []
      color = ""
  </code></pre>
  
  <p>I would now like to create as many objects from that class as I have of values in my 'colors' dict, then append into the indexArray attribute of these objects all the matching keys from the 'index' dictionary</p>
  
  <p>It would look something like this :</p>
  
  <pre><code>&gt;&gt;&gt;print(ColorArray0.color)
  ('255', '255', '255')
  &gt;&gt;&gt;print(ColorArray1.color)
  ('255', '148', '0')
  &gt;&gt;&gt;ColorArray0.indexArray.append(511)
  &gt;&gt;&gt;ColorArray1.indexArray.append(365)
  </code></pre>