Commit e3402907 authored by Julien Delafontaine's avatar Julien Delafontaine

Rewrote the 'Pure Python mode' tutorial and moved the 'Types' chapter to 'Language basics'.

parent 913d9a19
This diff is collapsed.
......@@ -64,6 +64,30 @@ an anonymous :keyword:`enum` declaration for this purpose, for example,::
ctypedef int* IntPtr
Types
-----
There are numerous types built in to the Cython module. One has all the
standard C types, namely ``char``, ``short``, ``int``, ``long``, ``longlong``
as well as their unsigned versions ``uchar``, ``ushort``, ``uint``, ``ulong``,
``ulonglong``. One also has ``bint`` and ``Py_ssize_t``.
For each type, there are pointer types ``p_int``, ``pp_int``, . . ., up to
three levels deep in interpreted mode, and infinitely deep in compiled mode.
The Python types int, long and bool are interpreted as C ``int``, ``long``
and ``bint`` respectively.
Also, the Python types ``list``, ``dict``, ``tuple``, . . . may
be used, as well as any user defined types. However at the moment they add very
few in terms of optimization to a simple ``object`` typing.
Pointer types may be constructed with ``cython.pointer(cython.int)``, and
arrays as ``cython.int[10]``. A limited attempt is made to emulate these more
complex types, but only so much can be done from the Python language.
Grouping multiple C declarations
--------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment