Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!border3.nntp.ams.giganews.com!backlog3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed4.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; 'tree': 0.05; 'suppose': 0.07; 'library?': 0.09; 'trees': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'jan': 0.12; 'question.': 0.14; 'calendar,': 0.16; 'dict': 0.16; 'mapping,': 0.16; 'task:': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'example': 0.22; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'possibly': 0.26; 'task': 0.26; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; "d'aprano": 0.31; 'steven': 0.31; 'maybe': 0.34; 'problem': 0.35; "can't": 0.35; 'problem.': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'combination': 0.36; 'list': 0.37; 'represent': 0.38; 'pm,': 0.38; 'reserved': 0.61; 'to:addr:gmail.com': 0.65; '2015': 0.84; 'balanced': 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=EGdV4Gm7oOzUxZuJRavlGc3prHPGkv7BBOkPHJB9m7Q=; b=v2/q9vzaijL15Ixx1eZrGZkSXzfjg+l2C+5DWsAB1bJE6tLPj2MOgTyi/MqSJU4Y/W kPr2I/jMWzJ+1IJumbOsAXJgVZkhCrhb+pUntMl7aUO3KAIcGJ2elapYvplvtTuzNkF4 KXbtm+1HHACaH+8p0/QauElpEEjtqPlECOYTVqCzZjYPsKskIjVWpSwWAPAW0VGsgCWk AbAiVCHmzNYCz6WOJoWUjUN1gB1sayyb7GiXjxCfZJG8qkw7tqQfPTTkudBF1waUWe0v EpPyw09VLMONOEtMdGEUVLp3RwIZJAZvf1lmMizOhUskRSSIDyk8QZ63T1D35cvBOU80 Tpsg== MIME-Version: 1.0 X-Received: by 10.152.5.7 with SMTP id o7mr36776830lao.26.1421745830981; Tue, 20 Jan 2015 01:23:50 -0800 (PST) In-Reply-To: References: <54bd8e6a$0$13009$c3e8da3$5496439d@news.astraweb.com> Date: Tue, 20 Jan 2015 09:23:50 +0000 Subject: Re: Trees From: Nicholas Cole To: Devin Jeanpierre Content-Type: text/plain; charset=UTF-8 Cc: "comp.lang.python" 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1421745832 news.xs4all.nl 2858 [2001:888:2000:d::a6]:51099 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84062 X-Original-Bytes: 4260 On Mon, Jan 19, 2015 at 11:52 PM, Devin Jeanpierre wrote: > On Mon, Jan 19, 2015 at 3: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? > > In general, any time you want to maintain a sorted list or mapping, > balanced search tree structures come in handy. > > Here's an example task: suppose you want to represent a calendar, > where timeslots can be reserved for something. Calendar events are not > allowed to intersect. Maybe because I'm not a computer scientist, I can't immediately see why this is a "Tree" problem and not a "Database" problem. Genuinely interested.