def bind(self, callback): if self.chains is None: self.chains = createChains(self.source, callback, self.locals, self.options) for chain in self.chains: chain.bind(self.root)
def dump(self, indent=0, outfile=None): """ Prints the list of binding chains in this expression to standard output or `outfile` if one was provided. """ outfile = outfile or sys.stdout indentspace = u' ' * indent print >> outfile, u'%sSource code: %s' % (indentspace, self.source) if not self.chains: self.chains = createChains(self.source, None, self.locals, self.options) for i, chain in enumerate(self.chains): node = chain txts = [] while node: txts.append(unicode(node)) node = node.next print >> outfile, u'%sChain %d: %s' % (indentspace, i + 1, u' -> '.join(txts))
def dump(self, indent=0, outfile=None): """ Prints the list of binding chains in this expression to standard output or `outfile` if one was provided. """ outfile = outfile or sys.stdout indentspace = u' ' * indent print(u'%sSource code: %s' % (indentspace, self.source), file=outfile) if not self.chains: self.chains = createChains(self.source, None, self.locals, self.options) for i, chain in enumerate(self.chains): node = chain txts = [] while node: txts.append(unicode(node)) node = node.next print(u'%sChain %d: %s' % (indentspace, i + 1, u' -> '.join(txts)), file=outfile)