title: how to loop faster through grpc response iterators with python
body: <p>I'm calling a <code>grpc</code> service with python that responds with about a million iterator objects. At the moment I'm using list comprehension to access the 1 attribute I need from the iterators:</p>
  <pre><code>stub = QueryStub(grpc_channel)
  return [object.attribute_i_need for object in stub.ResponseMethod]
  </code></pre>
  <p>To access around a million attributes takes a while (around 2-3 minutes). Is there a way I can speed this up? Interested to know how people process such scenarios faster. I have also tried using <code>list(stub.ResponseMethod)</code> and <code>[*stub.ResponseMethod]</code> to unpack or retrieve the objects faster, however these approaches take even longer since the iterator objects have a lot of other metadata I don't need and its storing them.</p>
  <p><strong>PS I don't necessarily need to store the attributes in memory, accessing them faster is what I'm trying to achieve</strong></p>