I asked the Shedskin developers about this issue and they are currently adding support for __call__ . They recommend renaming the class Matcher __call__ method ,for example as next, and then explicitly call it on line 148 as lookup_func.next(match). I followed their suggestion and the Shedskin 0.7 Python to C++ compiler does not complain about the unbound identifier 'lookup_func' anymore. I apologize for the cut and paste mangling. Is there a better method than copy-pasting for including 20 or more lines of python source code in the tutor posts? Thank you.
def find_all_matches(self, word, k, lookup_func): lev = self.levenshtein_automata(word, k).to_dfa() match = lev.next_valid_string('\0') while match: follow = lookup_func.test(match) ### line 148 ### if not follow: return if match == follow: yield match follow = follow + '\0' match = lev.next_valid_string(follow) class Matcher(object): def __init__(self, l): self.l = l self.probes = 0 def test(self, w): self.probes += 1 pos = bisect.bisect_left(self.l, w) if pos < len(self.l): return self.l[pos] else: return None
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor