]> kaliko git repositories - mpd-sima.git/commitdiff
Fixed str inheritance (calling __new__/super)
authorkaliko <efrim@azylum.org>
Fri, 1 Nov 2013 12:09:40 +0000 (13:09 +0100)
committerkaliko <efrim@azylum.org>
Fri, 1 Nov 2013 12:09:40 +0000 (13:09 +0100)
sima/lib/simastr.py

index 56cd2423a0474b540df2c4f010ee89f017585b0e..c7162144cd95cb3b3d65b793e3e18871ed16e220 100644 (file)
@@ -101,13 +101,15 @@ class SimaStr(str):
     def __init__(self, fuzzstr):
         """
         """
-        super().__init__(fuzzstr)
         self.orig = str(fuzzstr)
         self.stripped = str(fuzzstr.strip())
         # fuzzy computation
         self._get_root()
         self.remove_diacritics()
 
+    def __new__(cls, fuzzstr):
+        return super(SimaStr, cls).__new__(cls, fuzzstr)
+
     def _get_root(self):
         """
         Remove all patterns in string.