Ticket #5275: 5275.diff

File 5275.diff, 1.0 KB (added by ubernostrum, 8 years ago)

Patch documenting QuerySet.iterator()

  • docs/db-api.txt

    949949If you pass ``in_bulk()`` an empty list, you'll get an empty dictionary.
     954Evaluates the ``QuerySet`` (by performing the query) and returns an
     955`iterator`_ over the results. A ``QuerySet`` typically reads all of
     956its results and instantiates all of the corresponding objects the
     957first time you access it; ``iterator()`` will instead read results and
     958instantiate objects in discrete chunks, yielding them one at a
     959time. For a ``QuerySet`` which returns a large number of objects, this
     960often results in better performance and a significant reduction in
     961memory use.
     963Note that using ``iterator()`` on a ``QuerySet`` which has already
     964been evaluated will force it to evaluate again, repeating the query.
     966.. _iterator: http://www.python.org/dev/peps/pep-0234/
Back to Top