[Urwid] TreeNode vs ParentNode

Aleksandr Miroslav alexmiroslav at gmail.com
Sat Jul 21 14:27:30 EDT 2012


On Mon, Jul 16, 2012 at 10:56 PM, Ian Ward <ian at excess.org> wrote:
> Oh, I see what happened.  The reference docs are broken and just
> showing copies of the same classes.  Read the source instead, I'll fix
> the docs on the site soon.

Thank you for fixing this, I just saw that the docs were updated.

Now I have the question I originally wanted to ask:

Why use a TreeNode at all? Why not use a ParentNode everywhere? The leaf
nodes would then, instead of being TreeNodes, just be ParentNodes
without any children.

This way, if I wanted to add something to a leaf node, I can just simply
add a child node to it, since it is already a ParentNode. Otherwise, I
would have to convert the leaf node from a TreeNode to a ParentNode, and
then add the child node.

Does this make sense?

Thanks,
Alex



More information about the Urwid mailing list