Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61754
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <torriem+gmail@torriefamily.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'tree': 0.05; 'binary': 0.07; 'nested': 0.07; 'parser': 0.07; 'library?': 0.09; 'trees': 0.09; 'python': 0.11; 'wrote': 0.14; 'binary,': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'lisp': 0.16; 'node.': 0.16; 'subject:library': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'library': 0.18; "python's": 0.19; '(in': 0.22; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'nature': 0.30; 'overhead': 0.31; 'class': 0.32; 'lists': 0.32; 'ago': 0.33; 'problem.': 0.35; 'case,': 0.35; 'definition': 0.35; 'there': 0.35; 'processed': 0.36; 'example,': 0.37; 'list': 0.37; 'message-id:@gmail.com': 0.38; 'depends': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'itself': 0.39; 'structure': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'received:org': 0.40; 'even': 0.60; 'easy': 0.60; 'applicable': 0.60; 'most': 0.60; "you're": 0.61; 'kind': 0.63; 'car': 0.72 |
| X-Virus-Scanned | amavisd-new at torriefamily.org |
| Date | Thu, 12 Dec 2013 14:13:27 -0700 |
| From | Michael Torrie <torriem@gmail.com> |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130105 Thunderbird/10.0.12 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Tree library - multiple children |
| References | <52A9FD0A.9080804@gmail.com> |
| In-Reply-To | <52A9FD0A.9080804@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 8bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4023.1386882850.18130.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1386882850 news.xs4all.nl 2908 [2001:888:2000:d::a6]:52775 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:61754 |
Show key headers only | View raw
On 12/12/2013 11:14 AM, Ricardo Aráoz wrote: > I need to use a tree structure. Is there a good and known library? > Doesn't have to be binary tree, I need to have multiple children per node. There are lots of types of tree structures that may or may not be applicable to your problem. And it depends on what kind of data you're storing. For example, I wrote a parser years ago (in C) that processed BER-encoded structured data (sort of like binary xml). Turned out that the nested structure of BER-encoded data lends itself well to "left-child, right-sibling" trees (and it happens to be binary, which makes for easy traversal). In any even Python's data primitives are powerful enough that you don't need a library at all. Just use Python's built-in primitives. You can do most tree structures with just list manipulation, without any class overhead at all. In fact in my case, my "left-child right sibling" trees are by definition lists (think LISP car and cdr) or tuples. The LISP-esque nature of Python's data types always did make Python appeal to me.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Tree library - multiple children Michael Torrie <torriem@gmail.com> - 2013-12-12 14:13 -0700
csiph-web