Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Terry Reedy Newsgroups: comp.lang.python Subject: Re: Bug in Python? Date: Sat, 27 Feb 2016 06:48:51 -0500 Lines: 23 Message-ID: References: <56D0CCE9.2000301@mail.de> <56d16fff$0$1605$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de fydFsLuomZEuqxoY76pflQuqigyL8A4uJcWlgJRnayow== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'preferably': 0.05; '[],': 0.07; 'decision.': 0.09; 'falls': 0.09; 'okay': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subclass': 0.09; 'tracker,': 0.09; 'python': 0.10; 'jan': 0.11; '"to': 0.16; '*list*': 0.16; '2016': 0.16; 'heap': 0.16; 'heap,': 0.16; 'heapq': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'sad': 0.16; 'wrote:': 0.16; 'transform': 0.18; 'doc': 0.22; 'am,': 0.23; 'feb': 0.23; 'sat,': 0.23; 'header:In- Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'checking': 0.27; 'function': 0.28; 'actual': 0.28; 'initialized': 0.29; 'issues.': 0.29; 'says': 0.32; "d'aprano": 0.33; 'steven': 0.33; 'handle': 0.34; 'previous': 0.34; 'lists': 0.34; 'list': 0.34; 'instance': 0.35; 'lists.': 0.35; 'propose': 0.35; '(and': 0.36; 'to:addr:python- list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'version': 0.38; 'anything': 0.38; 'means': 0.39; 'to:addr:python.org': 0.40; 'back': 0.62; 'received:96': 0.63; 'else.': 0.66; '4:44': 0.91; 'received:fios.verizon.net': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: pool-96-227-207-81.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: <56d16fff$0$1605$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:103579 On 2/27/2016 4:44 AM, Steven D'Aprano wrote: > On Sat, 27 Feb 2016 07:55 pm, Terry Reedy wrote: > >> In other words, when that doc says *list*, it means a *list*. >> >> "To create a heap, use a list initialized to [], or you can transform a >> populated list into a heap via function heapify()." > [...] >> "A heap must be an instance of *list* (and not a subclass thereof). To >> create a heap, start with [] or transform an existing list into a heap >> via function heapify()." > > I think that's a sad decision. heapq ought to be able to handle any list > subclass, not just actual lists. Preferably it ought to handle duck-typed > lists too, anything with a list-like interface. It is okay if the optimized > C version only works with actual lists, and falls back to a slower Python > version for anything else. Propose that on the tracker, after checking previous issues. -- Terry Jan Reedy