From: Dag Sverre Seljebotn Date: Fri, 15 Aug 2008 19:22:09 +0000 (+0200) Subject: Added cutoff argument to Node.dump() utility X-Git-Tag: 0.9.8.1~32 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=67106b183ee00d59bf863caf8d464ee2a12c5781;p=cython.git Added cutoff argument to Node.dump() utility --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index c006d71d..4717fee8 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -176,10 +176,13 @@ class Node(object): self._end_pos = pos return pos - def dump(self, level=0, filter_out=("pos",)): + def dump(self, level=0, filter_out=("pos",), cutoff=100): + if cutoff == 0: + return "<...nesting level cutoff...>" + def dump_child(x, level): if isinstance(x, Node): - return x.dump(level) + return x.dump(level, filter_out, cutoff-1) elif isinstance(x, list): return "[%s]" % ", ".join([dump_child(item, level) for item in x]) else: