begging for a tree implementation
Sybren Stuvel
sybrenUSE at YOURthirdtower.com.imagination
Thu Apr 27 02:28:56 EDT 2006
Micah enlightened us with:
> I'm looking for a simple abstract-data-type tree. I would have thought
> there would be a built-in type, but I can't find one. I just need to
> be able to start from a root node and attach children from there. I
> could jury-rig one using a dict or some tuples, but I'd like a
> full-featured tree if someone has one implemented.
If you keep things that vague: use a list. See the first element as
the root node. Every node has only one child.
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
More information about the Python-list
mailing list