[Twisted-Python] RFC - List hierarchies in Woven
Abe Fettig
abe at fettig.net
Mon Aug 11 09:15:52 MDT 2003
On Mon, 2003-08-11 at 10:30, Christopher Armstrong wrote:
> Well, my first instinct would be move it into a completely separate
> Widget class.
Fair enough - I just put it into List since it's only a few additional
lines of code, and I didn't want to have to copy-paste the existing List
widget.
> Once that's done, I'd make the model, rather than a list
> of things with .children attributes, just a list of lists.
You could do it with lists, I suppose. Say you want to express a
typical hierarchical tree, like this:
Inbox
Outbox
Personal Mail
Joe
Fred
You could have a model like so:
[
["Inbox", []],
["Outbox", []],
["Personal Mail", [
["Joe", []],
["Fred", []]
]
]
Where each item in the tree is a list made up of two objects: item,
children.
Is that preferable? It still doesn't seem like the most elegant way of
doing things. Does anyone have a better idea?
Abe
More information about the Twisted-Python
mailing list