Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'tree': 0.05; 'pypi': 0.07; 'library?': 0.09; 'trees': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'jan': 0.12; 'cc:name:python list': 0.16; 'tempted': 0.16; 'wrote:': 0.18; 'implementing': 0.19; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; "i've": 0.25; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'probably': 0.32; 'at:': 0.34; 'common': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'url:org': 0.36; 'problems': 0.38; 'pm,': 0.38; 'most': 0.60; "you're": 0.61; 'times': 0.62; 'kind': 0.63; 'specialized': 0.65; 'to:addr:gmail.com': 0.65; '2015': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=cm73I6MPEWhfK7cGUKQpvpbDix4cxlWfUU1BoXOfykM=; b=E+q7tTKMo3/26yEytN08MzhPF64oU3I5Uazj5DT17HQc6Hv++L0TVrNgiD+fLHc75C LCR88024/OMLQrAvjuJPmyEnSVMYR6EDvRfANV2DPfxh4sfobVBuX4kO0lnRuyA1h1iV EQwBSGkMI5Mf1NB0tvG4klMIRn/2rBy0rJQzYRBKe2AUBoD7KPjKx6EmLsVkUsSay2KB Hf/xZuhr6PNBnYIZuYF8WXSLeS+sLR33F6y0r3GGSxE4lLHCqruHzpQEm+mQfEtLjQY7 CzqwVVXR22H8IPYyMo2wtp6gNmacVA+8BypRwKotYJpRf2myYG6Tr6/X+ycgNJgjXYee qX8g== MIME-Version: 1.0 X-Received: by 10.152.115.212 with SMTP id jq20mr14962756lab.36.1421714987074; Mon, 19 Jan 2015 16:49:47 -0800 (PST) In-Reply-To: References: Date: Mon, 19 Jan 2015 16:49:47 -0800 Subject: Re: Trees From: Dan Stromberg To: Zachary Gilmartin Content-Type: text/plain; charset=UTF-8 Cc: Python List 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1421715305 news.xs4all.nl 2922 [2001:888:2000:d::a6]:55672 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84048 On Mon, Jan 19, 2015 at 2:06 PM, Zachary Gilmartin wrote: > Why aren't there trees in the python standard library? Trees are kind of specialized datastructures; no one type of tree solves all tree-related problems suitably well. I think probably the most common need for a tree is implementing a cache, but most times you're tempted to sort inside a loop you're better off with a tree. I've put some time into python trees; most of them are on pypi and at: http://stromberg.dnsalias.org/~dstromberg/datastructures/ and: http://stromberg.dnsalias.org/~strombrg/python-tree-and-heap-comparison/ HTH