Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!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.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'tree': 0.05; 'binary': 0.07; 'cache': 0.07; 'python': 0.11; 'suggest': 0.14; 'better?': 0.16; 'which,': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'appears': 0.22; 'code,': 0.22; 'python?': 0.22; 'of.': 0.24; 'propose': 0.24; 'header:In-Reply-To:1': 0.27; 'wondering': 0.29; 'am,': 0.29; 'wonder': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:python': 0.33; 'subject: (': 0.35; 'one,': 0.35; 'plans': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'url:org': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'mar': 0.68; 'fact,': 0.69; 'led': 0.72; 'balanced': 0.84; 'aging': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=AzRzenGBW9//XPP09PpEuriaWQ5hBZt0sF7me813hac=; b=Hl9LtC+IZOZHFceLKb6a57lnt6DBAgDTETX2Uzq38ky9EQMTGqEtVGK97R51h+Wbgq UC3dZ08xGFZeDCDYN1+vfRUS60I+JnOWFFzL1+ASaHd1nIKDxEl/8puRT0T1daZJ5Qk7 x/fgk6Rwc9IZj+iD+EW8HcNqe4fE9YkQuXxGJQ8CL9fZjcM48XljVMG7mdPXJL+Oc+W+ ANy5iqDApLD70IonYG8VKZAVcZm03CX68ukJ8u3oN1z6DKBO84qcW32wK/6UDL8vg0FG Uage+u2B8PwxA3TIEjwjQlRy+kgV6Acu8grEgRPMQS0YfnLov1Lr31RdkgRqiAfgJ0ll fzxw== X-Received: by 10.68.240.36 with SMTP id vx4mr28165513pbc.140.1394276620776; Sat, 08 Mar 2014 03:03:40 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <87eh2d3x8h.fsf_-_@elektro.pacujo.net> References: <87eh2d3x8h.fsf_-_@elektro.pacujo.net> From: Ian Kelly Date: Sat, 8 Mar 2014 04:03:00 -0700 Subject: Re: Balanced trees (was: Re: Tuples and immutability) To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394276624 news.xs4all.nl 2902 [2001:888:2000:d::a6]:40288 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68027 On Sat, Mar 8, 2014 at 1:34 AM, Marko Rauhamaa wrote: > Speaking of which, are there plans to add a balanced tree to the > "batteries" of Python? Timers, cache aging and the like need it. I'm > using my own AVL tree implementation, but I'm wondering why Python > still doesn't have one. None currently that I'm aware of. If you want to propose adding one, I suggest reading: http://docs.python.org/devguide/stdlibchanges.html > In fact, since asyncio has timers but Python doesn't have balanced > trees, I'm led to wonder how good the asyncio implementation can be. Peeking at the code, it appears to use a heapq-based priority queue. Why would a balanced binary tree be better?