#37039: Outdated QuerySet.iterator() documentation
-------------------------+------------------------------------------------
Reporter: Lincoln | Type: Cleanup/optimization
Status: new | Component: Documentation
Version: | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------+------------------------------------------------
The `QuerySet.iterator()` documentation
(https://docs.djangoproject.com/en/dev/ref/models/querysets/#iterator)
says
> (internally, the default iterator calls iterator() and caches the return
value)
I take "the default iterator" to mean the QuerySet `__iter__()` method.
This does **not** call `iterator()`:
https://github.com/django/django/blob/378481165d14fea4c2a4b7717af3d7bdf9150f08/django/db/models/query.py#L417-L433
It only calls `_fetch_all()`, which as of this change
https://github.com/django/django/commit/f3b7c059367a4e82bbfc7e4f0d42b10975e79f0c
#diff-
d58ef61559dc7af5fdf7b56fee13571a4d2948e784cd608f6afeacf3ac2fb195R1075
no longer calls `iterator()`.
So this line in the documentation is no longer accurate. I think an
appropriate fix would be to simply remove that line of quoted text from
the docs.
--
Ticket URL: <https://code.djangoproject.com/ticket/37039>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019d99de6258-caaac154-be32-402b-aaf9-dbfe4f6c149f-000000%40eu-central-1.amazonses.com.