Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'tree': 0.05; 'binary': 0.07; 'library?': 0.09; 'trees': 0.09; 'python': 0.11; 'question.': 0.14; 'dict': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'wrote:': 0.18; 'header:User- Agent:1': 0.23; "aren't": 0.24; 'sort': 0.25; 'possibly': 0.26; 'task': 0.26; 'header:In-Reply-To:1': 0.27; "d'aprano": 0.31; 'steven': 0.31; "can't": 0.35; 'there': 0.35; 'combination': 0.36; 'possible': 0.36; 'list': 0.37; 'easily': 0.37; 'message- id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'charset:windows-1252': 0.65 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Mon, 19 Jan 2015 16:19:54 -0700 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Trees References: <54bd8e6a$0$13009$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <54bd8e6a$0$13009$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1421709608 news.xs4all.nl 2846 [2001:888:2000:d::a6]:33165 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84032 On 01/19/2015 04:08 PM, Steven D'Aprano wrote: > Zachary Gilmartin wrote: > >> Why aren't there trees in the python standard library? > > Possibly because they aren't needed? Under what circumstances would you use > a tree instead of a list or a dict or combination of both? > > That's not a rhetorical question. I am genuinely curious, what task do you > have that you think must be solved by a tree? > > Also, what sort of tree? Binary tree? Binary search tree? Red/black tree? > AVL tree? Splay tree? B-tree? T-tree? Scapegoat tree? General n-ary tree? > Every possible type of tree yet invented? Don't forget left-child,right-sibling trees. As I go through your list of trees, I can't find any tree type that cannot be easily and efficiently constructed with lists, possibly with dicts.