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


Groups > comp.lang.python > #103619

Re: Bug in Python?

From "Sven R. Kunze" <srkunze@mail.de>
Newsgroups comp.lang.python
Subject Re: Bug in Python?
Date 2016-02-28 10:52 +0100
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>

Show all headers | 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