]> Devi Nivas Git - chevron.git/commitdiff
Speed up unicode support.
authorDaniel Morrison <dan@morrison.ph>
Tue, 18 Nov 2014 04:13:53 +0000 (23:13 -0500)
committerDaniel Morrison <dan@morrison.ph>
Tue, 18 Nov 2014 04:13:53 +0000 (23:13 -0500)
- Remove uneeded import
- Remove uneeded if statement

chevron.py

index 6765baa8256b308f7a588e617ca34b4265bc9402..dd2f49ae063d5a332e149c1e1eb8e50d31c95a98 100755 (executable)
@@ -2,14 +2,16 @@
 
 import json
 
-from sys import argv, version
-
-python3 = False
-if version > '3':
-    python3 = True
+from sys import argv
 
+try:
+    unicode
+    python3 = False
+except:
     def unicode(x, y):
         return x
+    python3 = True
+
 
 class UnclosedSection(Exception):
     """Raised when you have unbalanced section tags"""