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


Groups > comp.lang.python > #103619

Re: Bug in Python?

Path csiph.com!news.swapon.de!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 10:52:45 +0100
Lines 26
Message-ID <mailman.4.1456653176.9760.python-list@python.org> (permalink)
References <56D0CCE9.2000301@mail.de> <CALwzidm+yx=j=+X8bNLWobTJjvXdm0gwq=8=5JhdOa853goJ4g@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de YDMu/1ATKIbeYMavA0H1jA+w046bTHFHxV86U4i201zw==
Return-Path <srkunze@mail.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.05; 'assumed': 0.09; 'imported.': 0.09; 'tends': 0.09; 'python': 0.10; 'python.': 0.11; 'ignore': 0.14; '2016': 0.16; 'ah,': 0.16; 'pymethoddef': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'implementing': 0.18; 'appears': 0.23; 'code.': 0.23; 'seems': 0.23; 'feb': 0.23; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'fri,': 0.27; 'right.': 0.27; 'operations,': 0.27; 'methods.': 0.29; 'thus,': 0.29; 'that.': 0.30; 'code': 0.30; 'guess': 0.31; 'skip:_ 10': 0.32; 'implement': 0.32; 'closely': 0.33; 'operations.': 0.33; 'rule': 0.33; 'know.': 0.34; 'received:10.0': 0.34; 'best,': 0.35; 'replaced': 0.35; 'comment': 0.35; 'sometimes': 0.35; 'too': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'difference': 0.38; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'some': 0.40; 'your': 0.60; 'back': 0.62; 'charset:windows-1252': 0.62; 'between': 0.65; 'here': 0.66; '26,': 0.72; 'forth': 0.79; 'verifying': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mail201212; t=1456653169; bh=QrK+Nv8mawbY2BurTA3l3oApAy83tSUXn3ksaw1qkwY=; h=Subject:To:References:From:Date:In-Reply-To:From; b=PqR8GIJyQhSC3RERJ0hktrkVSp1P1KpipjECIcnUW9pNVbOoUFC3UC0qdx22tuDU5 yWvjD+OZXiOWB+0QwHcQzHTAPT9fIZdzQ5P3GSkAXvX7Pns7nFUjeMlvcIkbu4OxOY GtxdmlIlfwUDL4FfLg4YGFVe3UvbxLj5CEOI6/HI=
In-Reply-To <CALwzidm+yx=j=+X8bNLWobTJjvXdm0gwq=8=5JhdOa853goJ4g@mail.gmail.com>
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 1029
X-purgate-ID 154282::1456653168-000018ED-5DAC325A/0/0
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:103619

Show key headers only | View raw


On 26.02.2016 23:37, Ian Kelly wrote:
> On Fri, Feb 26, 2016 at 3:08 PM, Sven R. Kunze <srkunze@mail.de> wrote:
>> Python sometimes seems not to hop back and forth between C and Python code.
> C code as a rule tends to ignore dunder methods. Those are used to
> implement Python operations, not C operations.

Ah, good to know.

>>          _siftup(heap, 0)    # that's C
> Your comment here appears to be incorrect.
>
> [snip]
>
> So I would guess that the difference here is because one
> implementation is entirely C, and the other implementation is entirely
> Python.

You are damn right. While implementing xheap and looking at the C 
implementation, I just assumed that all Python functions would be 
replaced by when the C module is imported. Furthermore, the C module 
exports some internal functions (leading _ ) such as _heappop_max. Thus, 
I assumed this is true for _siftup without verifying it by looking too 
closely at the PyMethodDef and PyModuleDef structs. Sorry for that.

Best,
Sven

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


Thread

Re: Bug in Python? "Sven R. Kunze" <srkunze@mail.de> - 2016-02-28 10:52 +0100

csiph-web