Skip to content

Identical children #17

@jmmcd

Description

@jmmcd

I was thinking of using asciitree to represent arithmetic expressions as trees, eg (2 * 2):

*
 +-- 2
 +-- 2

But this seems not to work, because one 2 overwrites the other, in the OrderedDict.

Here is my code:

from asciitree import LeftAligned
from collections import OrderedDict as OD
tree = {
    '*': OD([
        ('2', {}),
        ('2', {})
        ])
    }
tr = LeftAligned()
print(tr(tree))

and output:

*
 +-- 2

I guess the workaround would be to invent unique names for each 2?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions