Returns a pseudographic tree representation of x similar to the tree command
in Unix.
"""
- (MID, END, CONT, LAST, ROOT) = (u'|-- ', u'`-- ', u'| ', u' ', u'')
+ (MID, END, CONT, LAST, ROOT) = ('|-- ', '`-- ', '| ', ' ', '')
def rec(x, indent, sym):
line = indent + sym + show(x)
next_indent = indent + LAST
syms = [MID] * (len(xs) - 1) + [END]
lines = [rec(x, next_indent, sym) for x, sym in zip(xs, syms)]
- return u'\n'.join([line] + lines)
+ return '\n'.join([line] + lines)
- return rec(x, u'', ROOT)
+ return rec(x, '', ROOT)