PYTHON ACADEMY
The Programming School

Module - Python-Extensions with Other Languages

Motivation

Python can be readily connected with other languages. This way, existing libraries in other languages can be used.

Programming in Python is rather comfortable and efficient. The speed of Python programs for some tasks is considerably slower than for programs in other languages such as C/C++ or Java. As a solution slow program parts can be reimplemented in other languages and seamlessly incorporated in Python.

Furthermore, Python is often termed "glue languages" because of its ability to connected very different systems. The connection of libraries and programs that are implemented in other languages plays a important role for this ability.

Course Content

Python- Extensions with Pyrex

Pyrex is a special language for writing Python extensions. It has mainly Python syntax with some limitations and some additions that allow for automatic translation into C code suitable to be compiled in an Python extension. Examples are used to show how Pyrex works. The possibilities of incorporating existing C programs are also explained.

Use of DLLs with ctypes

The package ctypes allows to access DLLs or shared libraries from Python. It works on the operating systems Windows, Windows CE, Mac OS X, Linux, Solaris, FreeBSD, and OpenBSD. The language in which the DLL is implemented doesn't matter. The usage of ctypes is introduced with examples. Under Windows Microsoft's .NET compiler und the mingw (gcc) compiler are used to compile the DLL. The shared library under Linux Linux is compiled with the gcc. One focus is type conversion between Python and the DLL.

Use of Python's C-API

Standard Python is implemented in C and offers a comprehensive API for writing extensions. The basics of this API are taught. A working extension will be developed by hand that can be used by a Python program.

Automatic generation of Extensions with SWIG

The "Simplified Wrapper and Interface Generator" (SWIG) allows to make C/C** libraries accessible from 13 different languages. One of them is Python. The way SWIG works is covered using examples in C as well as in C++.

Jython

Jython is an implementation of Python in Java. It allows to access Java classes directly. The course covers the basics of Jython programs. Examples for use of existing Java classes as well as self written classes a used.

Use of FORTRAN Subroutines from Python

FORTRAN is one of the oldest programming languages but it is still in heavy use for scientific applications due to its high performance. There are many old but well proven numerical libraries that can be used from Python.

The usage of F2PY to connect FORTRAN77 as well as FORTRAN90/95 programs with Python is demonstrated. One focus are object-oriented interfaces to those libraries.

Exercises

The participants can follow all steps directly on their computers. There are exercises at the end of each unit providing ample opportunity to apply the freshly learned knowledge.

Course Material

Every participant receives comprehensive printed materials that cover the whole course content as wells as a CD with all source codes and used software.


Home
Python
Courses
Open Courses
Company Courses
Summer Course
Non-Programmers
Programmers
Scientists
Special Topics
Extensions
Optimizing
Windows
Threads
Network
Patterns
Dates
Prices
FAQ
Training Center
User Group
Jobboard
Workshop
EuroSciPy
References
News


What customers say ...

Very good introduction to the programming language.

Matthias Enderle, freelancer programmer
more ...


News


Next Meeting of Leipzig Python User Group, July 8th, 2008
details ...


Python Summer Course July 21 - 25, 2008
details ...


EuroSciPy July 26/27, 2008
details ...


Booth at Chemnitzer Linux-Tage
details ...


Videos Workshop 2007 available
details ...


Python is programming language of 2007
details ...


[Powered by rest2web]

[Python Powered]