From 9c0c66e0c16f68a7a0bb2eb2c5e8ae23c9c272d2 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 8 Oct 2019 22:33:29 -0400 Subject: Added a helpful comment --- django/template/base.py | 3 +++ 1 file changed, 3 insertions(+) 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 = {} -- cgit v1.2.1