Users Guide¶
Contents:
- Language Basics
- Extension Types
- Introduction
- Static Attributes
- Dynamic Attributes
- Type declarations
- Extension types and None
- Special methods
- Properties
- C methods
- Subclassing
- Forward-declaring extension types
- Fast instantiation
- Instantiation from existing C/C++ pointers
- Making extension types weak-referenceable
- Controlling deallocation and garbage collection in CPython
- Controlling pickling
- Public and external extension types
- Public extension types
- Dataclass extension types
- Special Methods of Extension Types
- Sharing Declarations Between Cython Modules
- Interfacing with External C Code
- Source Files and Compilation
- Early Binding for Speed
- Using C++ in Cython
- Fused Types (Templates)
- Porting Cython code to PyPy
- Migrating from Cython 0.29 to 3.0
- Limitations
- Differences between Cython and Pyrex
- Python 3 Support
- Conditional expressions “x if b else y”
- 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
- From __future__ directives
- Pure Python mode
- Typed Memoryviews
- Quickstart
- Using memoryviews
- Comparison to the old buffer support
- Python buffer support
- Memory layout
- Memoryviews and the GIL
- Memoryview Objects and Cython Arrays
- Cython arrays
- CPython array module
- Coercion to NumPy
- None Slices
- Pass data from a C function via pointer
- Performance: Disabling initialization checks
- Implementing the buffer protocol
- Using Parallelism
- Debugging your Cython program
- Cython for NumPy users
- Cython at a glance
- Your Cython environment
- Installation
- Manual compilation
- The first Cython program
- Adding types
- Efficient indexing with memoryviews
- Tuning indexing further
- Declaring the NumPy arrays as contiguous
- Making the function cleaner
- More generic code
- Using multiple threads
- Where to go from here?
- Creating Numpy ufuncs
- Pythran as a Numpy backend
- Cython and the GIL
- Troubleshooting
- FAQ