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


Groups > comp.lang.python > #81887 > unrolled thread

Re: Python, C++ interaction

Started bySturla Molden <sturla.molden@gmail.com>
First post2014-12-04 09:50 +0000
Last post2014-12-08 10:49 +0530
Articles 5 — 4 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#81887 — Re: Python, C++ interaction

FromSturla Molden <sturla.molden@gmail.com>
Date2014-12-04 09:50 +0000
SubjectRe: Python, C++ interaction
Message-ID<mailman.16550.1417686652.18130.python-list@python.org>
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

[toc] | [next] | [standalone]


#82024

Fromwesleiramos2@gmail.com
Date2014-12-05 14:17 -0800
Message-ID<ae15b4fa-8e4a-44b5-a17a-c74379ae0047@googlegroups.com>
In reply to#81887
Em quinta-feira, 4 de dezembro de 2014 07h51min14s UTC-2, Sturla Molden  escreveu:
> 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

m'giu vous êtès nom souris, pseudo nom cha'rs out oiu êtès, i'ret egop c'hâse

[toc] | [prev] | [next] | [standalone]


#82057

FromSturla Molden <sturla.molden@gmail.com>
Date2014-12-07 16:05 +0100
Message-ID<mailman.16669.1417964740.18130.python-list@python.org>
In reply to#82024
On 05/12/14 23:17, wesleiramos2@gmail.com wrote:

> m'giu vous êtès nom souris, pseudo nom cha'rs out oiu êtès, i'ret egop c'hâse

I have not idea what that means, but I am sure it would be interesting 
if I knew French (or whatever it is).


Sturla

[toc] | [prev] | [next] | [standalone]


#82071

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-12-07 17:26 +0000
Message-ID<mailman.16681.1417973215.18130.python-list@python.org>
In reply to#82024
On 07/12/2014 15:05, Sturla Molden wrote:
> On 05/12/14 23:17, wesleiramos2@gmail.com wrote:
>
>> m'giu vous êtès nom souris, pseudo nom cha'rs out oiu êtès, i'ret egop
>> c'hâse
>
> I have not idea what that means, but I am sure it would be interesting
> if I knew French (or whatever it is).
>

Please be careful, the guy who was selling forged Hungarian phrase books 
might now be selling French ones :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#82107

FromGayathri J <usethisid2014@gmail.com>
Date2014-12-08 10:49 +0530
Message-ID<mailman.16708.1418015975.18130.python-list@python.org>
In reply to#82024
Cython and number it is...
they definitely rule!

But of course I am also interfacing my python code (with all the
structuring and UI and object orientation) with some sse and fortran.
if u can get a grip of programming fortran/sse, they work too


On 12/7/14, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> On 07/12/2014 15:05, Sturla Molden wrote:
>> On 05/12/14 23:17, wesleiramos2@gmail.com wrote:
>>
>>> m'giu vous êtès nom souris, pseudo nom cha'rs out oiu êtès, i'ret egop
>>> c'hâse
>>
>> I have not idea what that means, but I am sure it would be interesting
>> if I knew French (or whatever it is).
>>
>
> Please be careful, the guy who was selling forged Hungarian phrase books
> might now be selling French ones :)
>
> --
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
>
> Mark Lawrence
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web