From: kaliko Date: Fri, 1 Nov 2013 12:09:40 +0000 (+0100) Subject: Fixed str inheritance (calling __new__/super) X-Git-Tag: mpd-sima/0.12.0pr2~34 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=380d9fb347d1d367eb1a421f32c9ebce640c1639;p=mpd-sima.git Fixed str inheritance (calling __new__/super) --- 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.