title: How to determine whether function returns an iterable object which calculates results on demand?
body: <p>How can one surelly tell that function retuns an iterable object, which calculates results on demand, and not an iterator, which returns already calculated results?</p>
  <p>For e.g. function <code>filter()</code> from python's documentation says:</p>
  <blockquote>
  <p>Construct an iterator from those elements of iterable for which function returns true</p>
  </blockquote>
  <p>Reading that I cat tell that this function returns an object which implements iterable protocol but I can't be sure it won't eat up all my memory if use it with generator which reads values from 16gb file untill I read further and see the Note:</p>
  <blockquote>
  <p>Note that filter(function, iterable) is equivalent to the generator expression (item for item in iterable if function(item))</p>
  </blockquote>
  <p>So, how does one can tell that function calculates returned results on demand and not just iterating over temporary lists which holds already calculated values? I have to inspect sources?</p>