From: Daniel Morrison Date: Sun, 16 Nov 2014 06:02:03 +0000 (-0500) Subject: Only define UnclosedSection once. X-Git-Url: https://git.devinivas.org/?a=commitdiff_plain;h=fcea1f35d4602fc85e5c5c7f965df246ff743904;p=chevron.git Only define UnclosedSection once. If you define things in a loop it slows down. Go figure. 42% speedup. --- diff --git a/entei.py b/entei.py index 53de592..8679773 100755 --- a/entei.py +++ b/entei.py @@ -5,6 +5,11 @@ import json from sys import argv +class UnclosedSection(Exception): + """Raised when you have unbalanced section tags""" + pass + + def tokenize(template): """Tokenize a mustache template @@ -30,10 +35,6 @@ def tokenize(template): the literal itself. """ - class UnclosedSection(Exception): - """Raised when you have unbalanced section tags""" - pass - tag_types = { '!': 'comment', '#': 'section',