| 1 |
.. note:: |
| 2 |
|
| 3 |
This page uses two different syntax variants: |
| 4 |
|
| 5 |
* Cython specific ``cdef`` syntax, which was designed to make type declarations |
| 6 |
concise and easily readable from a C/C++ perspective. |
| 7 |
|
| 8 |
* Pure Python syntax which allows static Cython type declarations in |
| 9 |
:ref:`pure Python code <pep484_type_annotations>`, |
| 10 |
following `PEP-484 <https://www.python.org/dev/peps/pep-0484/>`_ type hints |
| 11 |
and `PEP 526 <https://www.python.org/dev/peps/pep-0526/>`_ variable annotations. |
| 12 |
|
| 13 |
To make use of C data types in Python syntax, you need to import the special |
| 14 |
``cython`` module in the Python module that you want to compile, e.g. |
| 15 |
|
| 16 |
.. code-block:: python |
| 17 |
|
| 18 |
import cython |
| 19 |
|
| 20 |
If you use the pure Python syntax we strongly recommend you use a recent |
| 21 |
Cython 3 release, since significant improvements have been made here |
| 22 |
compared to the 0.29.x releases. |