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


Groups > comp.lang.python > #21320

Re: Porting the 2-3 heap data-structure library from C to Python

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'tends': 0.07; 'python': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:library': 0.09; 'library': 0.13; 'method.': 0.15; 'python?': 0.15; 'ctypes.': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'pdf:': 0.16; 'structures,': 0.16; 'url:cosc': 0.16; 'wrap': 0.18; 'seems': 0.20; 'header:In- Reply-To:1': 0.22; 'stefan': 0.24; 'subject:data': 0.25; 'work,': 0.28; 'described': 0.28; 'url:)': 0.29; 'url:src': 0.30; 'usually': 0.31; 'header:User-Agent:1': 0.33; 'instead': 0.33; 'test': 0.34; 'header:X-Complaints-To:1': 0.34; 'calling': 0.34; 'matter,': 0.34; 'to:addr:python-list': 0.35; 'received:org': 0.36; 'class.': 0.37; 'url:ac': 0.37; 'but': 0.37; 'using': 0.37; 'data': 0.38; 'url:org': 0.39; 'received:de': 0.39; 'subject:from': 0.39; 'recommended': 0.39; 'might': 0.40; 'to:addr:python.org': 0.40; 'url:nz': 0.67; '2-3': 0.73; 'url:c': 0.74; 'url:research': 0.91; 'available:': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Stefan Behnel <stefan_ml@behnel.de>
Subject Re: Porting the 2-3 heap data-structure library from C to Python
Date Wed, 07 Mar 2012 15:52:27 +0100
References <CAO+9iGejj95DkK2+vYSzoW3q10=1F+ThrTTaz9O_VMxXeXpzmw@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host fw-snc-frn5-de01.fw.telefonica.de
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2
In-Reply-To <CAO+9iGejj95DkK2+vYSzoW3q10=1F+ThrTTaz9O_VMxXeXpzmw@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.470.1331131962.3037.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1331131962 news.xs4all.nl 6853 [2001:888:2000:d::a6]:45048
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:21320

Show key headers only | View raw


Alec Taylor, 07.03.2012 15:25:
> I am planning to port the 2-3 heap data-structure as described by
> Professor Tadao Takaoka in Theory of 2-3 Heaps published in 1999 and
> available in PDF:
> http://www.cosc.canterbury.ac.nz/tad.takaoka/2-3heaps.pdf
> 
> The source-code used has been made available:
> http://www.cosc.canterbury.ac.nz/research/RG/alg/ttheap.h
> http://www.cosc.canterbury.ac.nz/research/RG/alg/ttheap.c
> 
> I plan on wrapping it in a class.
> 
> This tutorial I used to just test out calling C within Python
> (http://richizo.wordpress.com/2009/01/25/calling-c-functions-inside-python/)
> and it seems to work, but this might not be the recommended method.
> 
> Any best practices for how best to wrap the 2-3 heap data-structure
> from C to Python?

For data structures, where performance tends to matter, it's usually best
to start with Cython right away, instead of using ctypes.

http://cython.org/

Here's a tutorial for wrapping a C library with it:

http://docs.cython.org/src/tutorial/clibraries.html

Stefan

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


Thread

Re: Porting the 2-3 heap data-structure library from C to Python Stefan Behnel <stefan_ml@behnel.de> - 2012-03-07 15:52 +0100

csiph-web