A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-March/077892.html below:

[Python-Dev] Pretty-printing 2to3 Nodes

[Python-Dev] Pretty-printing 2to3 NodesDavid Wolever wolever at cs.toronto.edu
Thu Mar 20 06:04:01 CET 2008
Would anyone be averse to changing pytree.Node's __repr__ so it  
includes the name of the name of the symbol the node represents?

The only downside is that it makes the __reprs__ longer... But I  
think its worth the length:

Node(313:simple_stmt, [Node(298:import_name, [Leaf(1, 'import'), Node 
(279:dotted_as_name, [Node(281:dotted_name, [Leaf(1, 'foo'), Leaf(23,  
'.'), Leaf(1, 'bar')]), Leaf(1, 'as'), Leaf(1, 'bang')])]), Leaf(4,  
'\n')])
OR just names:
Node(import_name, [Leaf(1, 'import'), Node(dotted_as_name, [Node 
(dotted_name, [Leaf(1, 'foo'), Leaf(23, '.'), Leaf(1, 'bar')]), Leaf 
(1, 'as'), Leaf(1, 'bang')])])
OR the original:
Node(313, [Node(298, [Leaf(1, 'import'), Node(279, [Node(281, [Leaf 
(1, 'foo'), Leaf(23, '.'), Leaf(1, 'bar')]), Leaf(1, 'as'), Leaf(1,  
'bang')])]), Leaf(4, '\n')])
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4