From 380d9fb347d1d367eb1a421f32c9ebce640c1639 Mon Sep 17 00:00:00 2001 From: kaliko Date: Fri, 1 Nov 2013 13:09:40 +0100 Subject: [PATCH] Fixed str inheritance (calling __new__/super) --- sima/lib/simastr.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sima/lib/simastr.py b/sima/lib/simastr.py index 56cd242..c716214 100644 --- a/sima/lib/simastr.py +++ b/sima/lib/simastr.py @@ -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. -- 2.39.2