How to make Python run as fast (or faster) than Julia

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Feb 23 12:49:14 EST 2018


On Sat, 24 Feb 2018 00:03:06 +1100, Chris Angelico wrote:

>> Is numpy a general purpose C library that can also be called from any
>> language that can use a C API? Or is it specific to Python?
>>
>>
> No, it's a general purpose FORTRAN library that can also be called from
> any language that can use a generic C, FORTRAN, COBOL, etc API.

Numpy itself is a collection of Python interfaces to a number of C and 
Fortran libraries. You can't generally call numpy from other languages -- 
you can't even call numpy from other Python implementations, unless they 
support calling C/Fortran. Jython, for example, can't do it without help:

https://jyni.org/

and while PyPy can call numpy, doing so is slow, and there's a custom 
fork of numpy specially for PyPy:

https://bitbucket.org/pypy/numpy


Remember that numpy show cases the exact reason Python was invented: to 
act as an easy to use "glue language" to join together efficient and 
useful, but not so easy to use, libraries written in C and Fortran. 
Jython was invented to support Java libraries, and IronPython to make it 
easy to integrate with the Dot-Net ecosystem.

-- 
Steve




More information about the Python-list mailing list