summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-09-15 18:31:50 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-09-15 18:31:50 +0000
commitfb288d95574fddad38763beebbdbe918a2639d4d (patch)
treebab8d1a461cb3b0d3184358f8c59eb1cf99bb0d3 /docs
parente90eb41a4a1814ce3524fd46d97b1c32e537b9ea (diff)
Fixed #5275 -- Documented QuerySet.iterator(). Thanks, ubernostrum
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6303 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/db-api.txt17
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/db-api.txt b/docs/db-api.txt
index 5ce0aa01e7..08b5391e3c 100644
--- a/docs/db-api.txt
+++ b/docs/db-api.txt
@@ -951,6 +951,23 @@ Example::
If you pass ``in_bulk()`` an empty list, you'll get an empty dictionary.
+``iterator()``
+~~~~~~~~~~~~
+
+Evaluates the ``QuerySet`` (by performing the query) and returns an
+`iterator`_ over the results. A ``QuerySet`` typically reads all of
+its results and instantiates all of the corresponding objects the
+first time you access it; ``iterator()`` will instead read results and
+instantiate objects in discrete chunks, yielding them one at a
+time. For a ``QuerySet`` which returns a large number of objects, this
+often results in better performance and a significant reduction in
+memory use.
+
+Note that using ``iterator()`` on a ``QuerySet`` which has already
+been evaluated will force it to evaluate again, repeating the query.
+
+.. _iterator: http://www.python.org/dev/peps/pep-0234/
+
``latest(field_name=None)``
~~~~~~~~~~~~~~~~~~~~~~~~~~~