Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'yet.': 0.04; 'root': 0.05; 'tree': 0.05; 'binary': 0.07; 'nested': 0.07; 'library?': 0.09; 'python': 0.11; '2],': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'node.': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'subject:library': 0.16; 'typo': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'header:User- Agent:1': 0.23; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; "doesn't": 0.30; 'dec': 0.30; 'lists?': 0.31; 'received:84': 0.35; 'there': 0.35; 'clear': 0.37; 'represent': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; '12,': 0.39; 'to:addr:python.org': 0.39; 'easy': 0.60; 'such': 0.63; 'more': 0.64; 'header:Reply-To:1': 0.67; '3-4': 0.68; 'reply-to:no real name:2**0': 0.71; 'reply-to:addr:python.org': 0.84; 'joel': 0.91; '2013': 0.98 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=IvYnLtPg c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=baqLi5_GPZIA:10 a=SUW9G-qWqQQA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=7fQ8G-tBXuoA:10 a=pGLkceISAAAA:8 a=-Xn7MNikF-DyiteYPdkA:9 a=wPNLvfGTeEIA:10 a=MSl-tDqOz04A:10 X-AUTH: mrabarnett:2500 Date: Thu, 12 Dec 2013 19:38:10 +0000 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Tree library - multiple children References: <52A9FD0A.9080804@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386877088 news.xs4all.nl 2902 [2001:888:2000:d::a6]:59308 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61747 On 12/12/2013 19:30, Joel Goldstick wrote: > On Thu, Dec 12, 2013 at 2:26 PM, Neil Cerutti > wrote: > > On 2013-12-12, 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. > > Have you tried nested lists? > > [[1, 2], [3, 4] > > I think that was a type for this: > I think that was a typo for "typo". :-) > [[1, 2], [3, 4]] > > > Can represent > > root > / \ > 1-2 3-4 > > Python makes it very easy to manipulate such a structure. It > isn't clear that you need more than that yet. >