PYTHON ACADEMY
Training & Consulting

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++, C#, Java, or FORTRAN. 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

Introduction to Example

We use a computationally intensive example throughout the course. This allows for comparison of the different extension methods.

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.

Python Extensions with Pyrex/Cython

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.

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 are used.

IronPython

IronPython is a implementation of Python in .NET. It allows Access to all .NET features and makes it a first class .NET language right next to C# and Visual Basic. The course introduces IronPython, demonstrates how to use .NET assemblies, and how access self written C# classes.

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.

Module Duration

1 day

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
News
Courses
Open Courses
Company Courses
Cheminformatics
Summer Course
Non-Programmers
Programmers
Scientists
Optimizing and Extending
Special Topics
Extensions
Optimizing
Windows
Threads
Network
Patterns
WxPython
IronPython
Dates
Prices
Consulting
FAQ
Training Center
User Group
Jobboard
Workshop
Events
References


What customers say ...


We had a wide range of Python experience in our group and each person gained something valuable to take away....

Dr. Ryan Woodard, Chair of Entrepreneurial Risks, ETH Zurich, Switzerland more ...


I can absolutely recommend this course to everybody who wants become productive with Python very quickly. ...

Dr. med. Beat Meister, Bern, Switzerland more ...


The standard Python for programmers and the customized "Python for Experts" course where a great success. ...

Bart Hillaert, Alcatel-Lucent Belgium more ...


[The trainer] knows well what scientists need, so his hints are very practical and valuable. The hands-on course [..] covers a wide range of examples and will be very helpful in my daily work. ...

Dorota Jarecka, University of Warsaw about the course "Python for Scientists and Engineers" more ...


The course "Python for Scientists and Engineers" is a very useful introduction to Python programming for scientific applications ...

Dr Mihai Duta, Oxford Supercomputing Centre more ...


Very good introduction to the programming language.

Matthias Enderle, freelancer programmer more ...



News

Course "Python Summer Course", August 16 - 21, 2010
details ...


Course "Python for Programmers", August 16 - 18, 2010
details ...


Course "Python for Scientists and Engineers", August 19 - 21, 2010
details ...

Next Meeting of Leipzig Python User Group, September 21, 2010
details ...


[Powered by rest2web]

[Python Powered]