summaryrefslogtreecommitdiff
path: root/django/template/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/template/base.py')
-rw-r--r--django/template/base.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/template/base.py b/django/template/base.py
index d8a35f2768..296c1307c0 100644
--- a/django/template/base.py
+++ b/django/template/base.py
@@ -405,6 +405,9 @@ class DebugLexer(Lexer):
class Parser:
def __init__(self, tokens, libraries=None, builtins=None, origin=None):
+ # We reverse the tokens so `next_token`, `prepend_token`, and
+ # `delete_first_token` can all operate at the end of the list, which
+ # is O(1).
self.tokens = list(reversed(tokens))
self.tags = {}
self.filters = {}