Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103621

Re: Bug in Python?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From "Sven R. Kunze" <srkunze@mail.de>
Newsgroups comp.lang.python
Subject Re: Bug in Python?
Date Sun, 28 Feb 2016 11:24:00 +0100
Lines 36
Message-ID <mailman.6.1456655049.9760.python-list@python.org> (permalink)
References <56D0CCE9.2000301@mail.de> <CACL+1asoZSWcuB2fX3qLNinu8Eo1aEeEd0o+c88=3dKbbJY-eA@mail.gmail.com> <mailman.167.1456563356.20994.python-list@python.org> <56d16fff$0$1605$c3e8da3$5496439d@news.astraweb.com> <nas2fc$p0p$2@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de 3SzkREZG27ZEPkGRzMqtGgI+rK1HWMLjvoFQOdHc8ybg==
Return-Path <srkunze@mail.de>
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; 'subject:Python': 0.05; 'preferably': 0.05; '[],': 0.07; 'decision.': 0.09; 'falls': 0.09; 'okay': 0.09; 'subclass': 0.09; 'tracker,': 0.09; 'python': 0.10; '"to': 0.16; '*list*': 0.16; '2016': 0.16; 'heap': 0.16; 'heap,': 0.16; 'heapq': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'sad': 0.16; 'wrote:': 0.16; 'transform': 0.18; '>>>': 0.20; 'doc': 0.22; 'am,': 0.23; 'feb': 0.23; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'checking': 0.27; 'function': 0.28; 'actual': 0.28; 'initialized': 0.29; 'issues.': 0.29; 'there.': 0.30; 'says': 0.32; "d'aprano": 0.33; 'steven': 0.33; 'handle': 0.34; 'previous': 0.34; 'received:10.0': 0.34; 'lists': 0.34; 'list': 0.34; 'best,': 0.35; 'instance': 0.35; 'lists.': 0.35; 'propose': 0.35; '(and': 0.36; "wasn't": 0.36; 'to:addr:python- list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'agree': 0.37; 'things': 0.38; 'version': 0.38; 'anything': 0.38; 'means': 0.39; 'why': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'chance': 0.60; 'your': 0.60; 'close': 0.61; 'real': 0.62; 'back': 0.62; 'charset:windows-1252': 0.62; 'else.': 0.66; 'increase': 0.73; '4:44': 0.91; 'hands': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mail201212; t=1456655042; bh=TYnwsfWRG1SSyQ1K0qW2qrLFfGwCrdZ2t1mlRPoANCg=; h=Subject:To:References:From:Date:In-Reply-To:From; b=pjMgeqYhjaMJkkAqMBCBzyMKRntctI2BaFywI1XshYm+aK4Uu+VkNnd+iU7KiuqbA L76OH1ooiqlxPb3AuASRqSvwxBA3oD/r2xWlb1NB/nhZQIMK0pk644iosZVnsOIRMC +1smjdthKxg+7eZdDdgoRj376Y8KF4t0KXnKctG8=
In-Reply-To <nas2fc$p0p$2@ger.gmane.org>
X-purgate clean
X-purgate This mail is considered clean (visit http://www.eleven.de for further information)
X-purgate-type clean
X-purgate-Ad Categorized by eleven eXpurgate (R) http://www.eleven.de
X-purgate This mail is considered clean (visit http://www.eleven.de for further information)
X-purgate clean
X-purgate-size 4125
X-purgate-ID 154282::1456655042-00004575-80DBDFD7/0/0
X-Content-Filtered-By Mailman/MimeDel 2.1.21rc2
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:103621

Show key headers only | View raw


On 27.02.2016 12:48, Terry Reedy wrote:
> 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.
>

I agree that it would increase comprehensibility. I took me a fair 
amount of time to see why things are not working as intended (and as you 
see I wasn't even close to the real explanation).

However, heapq might work well the way it is as long as you have the 
chance to get your hands on one of the other heap implementations out there.

> Propose that on the tracker, after checking previous issues.

:)

Best,
Sven

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: Bug in Python? Terry Reedy <tjreedy@udel.edu> - 2016-02-27 03:55 -0500
  Re: Bug in Python? Steven D'Aprano <steve@pearwood.info> - 2016-02-27 20:44 +1100
    Re: Bug in Python? Terry Reedy <tjreedy@udel.edu> - 2016-02-27 06:48 -0500
    Re: Bug in Python? "Sven R. Kunze" <srkunze@mail.de> - 2016-02-28 11:24 +0100

csiph-web