នៅថ្ងៃ ពុធ 13 មិថុនា 2007 19:09, Kent Johnson បានសរសេរថា ៖ > hok kakada wrote: > >> What kind of object is matcher? Does it have any attributes that are > >> functions? (Not methods you defined for the class, but functions or > >> methods that you assign to attributes of self.) > > > > Actually, I use the translate-toolkit from > > http://translate.sourceforge.net/snapshots/translate-toolkit-1.0.1rc1/ > > in translate/search/match.py: > > if comparer is None: > > comparer = lshtein.LevenshteinComparer(max_length) > > > > self.comparer = comparer > > > > I just found the problem that it is because of the LevenshteinComparer. > > Once I assign self.comparer = None, the I can dump the matcher > > successfully. However, I still don't understand what could be wrong with > > LevenshteinComparer. > > I think the problem is this code in LevenshteinComparer.__init__(): > > if Levenshtein: > self.distance = self.native_distance > else: > self.distance = self.python_distance > > which assigns an instance method to an instance attribute; this is the > instancemethod that can't be pickled. Ok...but how can we deal with it?
Kind Regards, da _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor