]> Devi Nivas Git - chevron.git/commitdiff
Change version checking method. (flake8)
authornoah morrison <noah@morrison.ph>
Sun, 25 Jan 2015 20:41:30 +0000 (15:41 -0500)
committernoah morrison <noah@morrison.ph>
Sun, 25 Jan 2015 20:41:30 +0000 (15:41 -0500)
Importing sys is better then checking if unicode is defined.

chevron/renderer.py

index c5dea30e801a1915f514f26bb6fc03e9ba2a9f2b..a665122c696942fecf284c07aea23587af4698e8 100644 (file)
@@ -12,13 +12,15 @@ except (ValueError, SystemError):
     from tokenizer import tokenize
 
 
-try:  # python 2
-    unicode
-    python3 = False
-except:
+import sys
+if sys.version_info[0] == 3:
+    python3 = True
+
     def unicode(x, y):
         return x
-    python3 = True
+
+else:  # python 2
+    python3 = False
 
 
 #