#31582: Django template engine render pre-fetches data even when iterator() is
used
---------------------------------+------------------------------------
Reporter: Sümer Cip | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: 3.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Carlton Gibson):
* type: Bug => New feature
* stage: Unreviewed => Accepted
Comment:
Good follow up both, that's super!
At first glance, certainly :), consuming the iterator into a list isn't
ideal.
Question is, what can we do about it?
The next line is:
{{{
len_values = len(values)
}}}
Then `len_values` is used to populate the various loop counter variables.
`revcounter`, `last` and so on.
I haven't thought it through but, I could see these possibly being made
optional, maybe along the lines of adding an extra option like `reversed`?
(It would require editing the `do_for()` function to parse another option.
Not sure what it should be: ...`iterator`? 😬)
I think we'd have to call that a new feature. The behaviour isn't
**incorrect**, it just uses more memory than we'd like in this case.
Let's provisionally accept on that basis. It might be worth pinging the
DevelopersMailingList to seek advice on how to proceed, particularly with
regard to the possible API for such a change.
--
Ticket URL: <https://code.djangoproject.com/ticket/31582#comment:8>
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 on the web visit
https://groups.google.com/d/msgid/django-updates/064.ab1354a14c87eddece1267afc30ae0d9%40djangoproject.com.