summaryrefslogtreecommitdiff
path: root/docs/src/two-syntax-variants-used
blob: af583a0a9fefc165956dc19a4cb2460da06efc9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
.. note::

    This page uses two different syntax variants:

    * Cython specific ``cdef`` syntax, which was designed to make type declarations
      concise and easily readable from a C/C++ perspective.

    * Pure Python syntax which allows static Cython type declarations in
      :ref:`pure Python code <pep484_type_annotations>`,
      following `PEP-484 <https://www.python.org/dev/peps/pep-0484/>`_ type hints
      and `PEP 526 <https://www.python.org/dev/peps/pep-0526/>`_ variable annotations.

      To make use of C data types in Python syntax, you need to import the special
      ``cython`` module in the Python module that you want to compile, e.g.

      .. code-block:: python

          import cython