Navigation
next
Cython v0.9.8.1.1 documentation
»
Welcome to Cython’s Users Guide
¶
Contents:
Overview
About Cython
Future Plans
Tutorial
The Basics of Cython
Cython Hello World
pyximport
: Cython Compilation the Easy Way
Fibonacci Fun
Primes
Language Details
Cython for NumPy users
Cython at a glance
Your Cython environment
Installation
Manual compilation
The first Cython program
Adding types
Efficient indexing
Tuning indexing further
More generic code
The future
Language Basics
Python functions vs. C functions
Grouping multiple C declarations
Extension Types
Introduction
Attributes
Type declarations
Extension types and None
Special methods
Properties
Subclassing
C methods
Forward-declaring extension types
Making extension types weak-referenceable
Public and external extension types
Sharing Declarations Between Cython Modules
Definition and Implementation files
What a Definition File contains
What an Implementation File contains
The cimport statement
Sharing C Functions
Sharing Extension Types
Interfacing with External C Code
External declarations
Using Cython Declarations from C
Source Files and Compilation
Basic setup.py
Cython Files Depending on C Files
Multiple Cython Files in a Package
Distributing Cython modules
Pyximport
Wrapping C++ Classes in Cython
Overview
Procedure Overview
An example C++ API
Specify C++ language in setup.py
Create cdef extern from block
Create Cython wrapper class
Caveats and Limitations
Conclusion
Limitations
Unsupported Python Features
Other Current Limitations
Differences between Cython and Pyrex
Package names and cross-directory imports
List Comprehensions
Conditional expressions “x if b else y” (python 2.5)
cdef inline
Assignment on declaration (e.g. “cdef int spam = 5”)
‘by’ expression in for loop (e.g. “for i from 0 <= i < 10 by 2”)
Boolean int type (e.g. it acts like a c int, but coerces to/from python as a boolean)
Executable class bodies
cpdef functions
Automatic range conversion
More friendly type casting
Optional arguments in cdef/cpdef functions
Function pointers in structs
C++ Exception handling
Synonyms
Source code encoding
Automatic
typecheck
Early Binding for Speed
Indices and tables
¶
Index
Module Index
Search Page
Table Of Contents
Welcome to Cython’s Users Guide
Indices and tables
Next topic
Overview
This Page
Show Source
Quick search
Navigation
next
Cython v0.9.8.1.1 documentation
»