Course: Extending Python with the C languagePYTHON-C-EXT

The course is available on demand.

Remote training: online live with a trainer and a group. Available on demand, at time and place convenient to you, for groups of at least 3 participants.

exempt from VAT

Price: 590 EUR

refreshments included

computer station included

Category: Python

Having to write your own Python extensions in C can be caused by different circumstances. You might need to use a library, which is available only from the C level, for example OpenSSL bignum. Sometimes, performance requirements for a certain fragment of the codebase make an implementation in C the only possible solution. Other times you need to use a system call which is unavailable from Python and writing C code is the only way to get to it.

In this training we will show you how to write Python extensions, how to easily call functions from libraries without Python interfaces and how to connect code written in high level languages (like Python) with bits of low level code in C. We will take a closer look at Python’s garbage collection system and the ways in which our code can cooperate with it. We will describe the most common problems and how to solve them.

Our trainers are seasoned Python developers, with many years of experience in creating applications in Python, including writing custom C extensions.

Duration

1 day

Agenda

  1. Python interfaces for C
    • Defining functions
    • Fetching and returning data
    • Cooperation with the garbage collector
    • Defining classes and exceptions
    • Working with the GIL
  2. Compilation
    • the _setup.py_file, defining extensions
    • Linking dynamic libraries
    • Writing portable code
  3. Other methods of mixing Python and C
    • the ctypes library
      • Loading shared libraries
      • Calling functions, passing arguments
      • Writing programs in Pyrex
    • Embedding the Python interpreter in C programs

      During our courses we use the latest Python version (branch 2). In case of on-demand courses, it’s possible to use any version required by the Client, according to his needs.

Download as PDF

Audience and prerequisites

Good knowledge of Python, solid knowledge of C, experience in compiling software on Linux.

Certificates

Course participants receive completion certificates signed by ALX.

There are currently no entries
Enter your e-mail address and we will notify you about future dates