Commits

spirit committed 65ca63e

Improved LanguageInfo substitute for Python 2.5

  • Participants
  • Parent commits 37f2fe3

Comments (0)

Files changed (1)

File guess_language/__init__.py

 
     LanguageInfo = namedtuple("LanguageInfo", ["tag", "id", "name"])
 except ImportError:
-    class LanguageInfo:
+    class LanguageInfo(tuple):
         def __new__(cls, tag, id, name):
-            return tuple((tag, id, name))
+            return tuple.__new__(cls, (tag, id, name))
+
+        def __init__(self, tag, id, name):
+            self.tag = tag
+            self.id = id
+            self.name = name
 
 
 class UNKNOWN(str):