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


Groups > comp.lang.python > #81887

Re: Python, C++ interaction

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.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'languages.': 0.04; 'cpython': 0.05; 'subject:Python': 0.06; 'compiler': 0.07; 'computing,': 0.07; 'pypy': 0.07; 'dan': 0.09; 'decorator': 0.09; 'high-level': 0.09; 'option,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subset': 0.09; 'python': 0.11; "(it's": 0.16; '-o2': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'scientists': 0.16; 'steps,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'numerical': 0.19; 'later': 0.20; 'header:User-Agent:1': 0.23; 'compilation': 0.24; 'decorators': 0.24; 'java': 0.24; "i've": 0.25; 'mention': 0.26; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'external': 0.29; 'forgot': 0.30; 'code': 0.31; 'easier': 0.31; 'usually': 0.31; 'ctypes': 0.31; 'fast.': 0.31; 'libraries': 0.31; 'anyone': 0.31; 'standards': 0.33; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'c++': 0.36; 'opposed': 0.36; 'sometimes': 0.38; 'to:addr:python- list': 0.38; 'anything': 0.39; 'heard': 0.39; 'use.': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:n 10': 0.64; 'comparable': 0.84; 'forever.': 0.91; 'suited': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Sturla Molden <sturla.molden@gmail.com>
Subject Re: Python, C++ interaction
Date Thu, 4 Dec 2014 09:50:33 +0000 (UTC)
References <547EC9E2.8070502@perfect-kreim.de> <CAGGBd_oEtFqDG6OPVE+AZYZvCRRPMWjKk5RiFzcaLZqia+K+Zg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host 20-137-11.connect.netcom.no
User-Agent NewsTap/4.0.1 (iPad)
X-
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Newsgroups comp.lang.python
Message-ID <mailman.16550.1417686652.18130.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417686652 news.xs4all.nl 2835 [2001:888:2000:d::a6]:51816
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:81887

Show key headers only | View raw


Dan Stromberg <drsalists@gmail.com> wrote:

> 1) writing in Cython+CPython (as opposed to wrapping C++ with Cython)

That is an option, but it locks the code to Cython and CPython forever. C
and C++ are at least semi-portable.

> 2) using numba+CPython (It's a pretty fast decorator - I've heard it's
> faster than Cython)

Numba is usually not "faster than Cython" (Cython can be as fast as C), but
it can be pretty fast. Sometimes it is comparable to -O2 in C for the
subset of Python it supports, but usually a bit slower. But if you can use
it, it is easier to use than Cython. There are no extra compilation steps,
etc. Just add a couple of decorators to the Python code and it takes off
like a rocket. For anyone who are familiar with PyPy and Psyco, Numba is
far better than those. It is a Python JIT compiler that often can perform
better than the Java VM. Numba will also JIT-compile Python code that uses
ctypes or cffi to call external libraries down to almost zero overhead.

You forgot to mention using Fortran and f2py. Many scientists and engineers
prefer Fortran to C and C++ because it is easier to use. And Fortran 90 and
later standards are not anything like the loathed Fortran 66 and 77
languages. Fortran is a high-level language particularly suited for
numerical computing, C is a semi-portable high-level assembler. 

Sturla

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


Thread

Re: Python, C++ interaction Sturla Molden <sturla.molden@gmail.com> - 2014-12-04 09:50 +0000
  Re: Python, C++ interaction wesleiramos2@gmail.com - 2014-12-05 14:17 -0800
    Re: Python, C++ interaction Sturla Molden <sturla.molden@gmail.com> - 2014-12-07 16:05 +0100
    Re: Python, C++ interaction Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-12-07 17:26 +0000
    Re: Python, C++ interaction Gayathri J <usethisid2014@gmail.com> - 2014-12-08 10:49 +0530

csiph-web