title: Getting an updated object value inside a Python for loop
body: <p>I have an object called &quot;ticker&quot; that is collecting streaming data from Interactive Brokers via ib_insync.</p>
  <p>I am simply trying to create a list and updated it with new, for example, bid prices from the ticker object every 250 milliseconds or so.  When I try to get updated values via the for loop, I am not getting updated values through each iteration, just the original value from the first pass.</p>
  <p>I assume I have a lack of understanding around scope inside the for loop which is creating this issue. How can I do this correctly?</p>
  <p>Here is the code:</p>
  <pre><code>contract = Stock('IBM', 'SMART', 'USD') # this defines the contract
  ticker = ib.reqMktData(contract) # this creates the ticker object for the specified contract
  vec = [0] * 100
  for m in vec:
      vec.pop(0)
      vec.append(ticker.bid)
      print(vec)
      time.sleep(.25)
  </code></pre>