title: Dumping unique information from a for loop into a class item
body: <p><em>Bear with me as I'm a new, self-taught python developer and I'm sure I'm using some pretty abysmal conventions/practices. Also, my first post on stackoverflow.</em></p>
  <p>I'm writing a live timing program that pulls information from an SDK for drivers within a practice/qualifying/race session. This is updated every second.</p>
  <p>Ultimately all of this information is printed back out within the terminal in a particular format.
  (There will be a UI once the initial information is correct.)</p>
  <p>Within the SDK there are two different sections where I need to pull information.
  SessionInfo is sorted by car position.
  DriverInfo is sorted by carID.</p>
  <p>SessionInfo has CarID information that can be tied to the same number CarID in DriverInfo.</p>
  <p>I figured that the easiest way to perform this, along with updating all of the data acquired, would be to create this class so that the information is global:</p>
  <pre><code>class Driver:
  def __init__(self, DICarID, SICarID, DICarNum, DIIrating, DILicString, Position, ClassPosition, DIUserName, CurrentTime, FastestLap, FastestTime, LastTime, LapsComplete, Incidents, ReasonOutStr):
      self.DICarID = DICarID
      self.SICarID = SICarID
      self.DICarNum = DICarNum
      self.DIIrating = DIIrating
      self.DILicString = DILicString
      self.Position = Position
      self.ClassPosition = ClassPosition
      self.DIUserName = DIUserName
      self.CurrentTime = CurrentTime
      self.FastestLap = FastestLap
      self.FastestTime = FastestTime
      self.LastTime = LastTime
      self.LapsComplete = LapsComplete
      self.Incidents = Incidents
      self.ReasonOutStr = ReasonOutStr
  </code></pre>
  <p>Then ultimately using a for loop, gather the information for each CarID and write it to Driver().</p>
  <p>The only way I can think to do this would be to create unique variables. I'm told this is a bad idea unless there's a good reason to dynamically generate variables within a loop.</p>
  <p>ie:</p>
  <pre><code>driver(x) = Driver(driverInfo['CarIDx'], sessionInfo['CarIDx']...)
  </code></pre>
  <p>I'm not certain of the proper way to perform that.
  Maybe it's easiest to go with the recommended method of creating a list.</p>
  <p>Any help would be appreciated. I'll edit this with more info if it's needed.</p>
  <p>EDIT: I was asked why I was storing SICarID and DICarID if they were identical. In retrospect, maybe dividing SI data and DI data into their own seperate classes would be the way to go. However, the initial idea is to pair those two numbers just to debug and verify that the associated data is correct.</p>
  <pre><code>print(driver.DICarID, driver.SICarID)
  </code></pre>
  <p>Currently would display:</p>
  <pre><code>0 10 
  1 2
  2 14
  3 12
  4 6
  5 16
  6 1   
  7 4 
  8 0
  9 7       
  10 8
  11 11
  12 19
  13 5  
  14 13
  </code></pre>
  <p>There are other drivers in this particular session not being displayed since they have not posted a time.</p>
  <p>Here is how the information is formatted currently within the string (heavily redacted):</p>
  <pre><code>SessionInfo:
   Sessions:
   {
    ResultsPositions: #In positional order
    {
    Position: %d
    ClassPosition: %d
    CarIdx: %d
    Lap: %d
    Time: %.3f
    FastestLap: %d
    FastestTime: %.3f
    LastTime: %.3f
    LapsLed: %d
    LapsComplete: %d
    LapsDriven: %.3f
    Incidents: %d
    ReasonOutId: %d
    ReasonOutStr: %s
    }
   }
  DriverInfo: #In order of carID
   Drivers:
   {
   CarIdx: %d
   UserName: %s
   UserID: %d
   TeamID: %d
   TeamName: %s
   CarNumber: &quot;%s&quot;
   IRating: %d
   LicString: %s
  }
  </code></pre>