Since Cython mixes C and Python semantics, some things may be a bit surprising or unintuitive. Work always goes on to make Cython more natural for Python users, so this list may change in the future.
10**-2 == 0, instead of
0.01like in Python.
- Given two typed
a % bhas the same sign as the second argument (following Python semantics) rather then having the same sign as the first (as in C). The C behavior can be obtained, at some speed gain, by enabling the division directive. (Versions prior to Cython 0.12. always followed C semantics.)
- Care is needed with unsigned types.
cdef unsigned n = 10; print(range(-n, n))will print an empty list, since
-nwraps around to a large positive integer prior to being passed to the
floattype actually wraps C
doublevalues, and Python’s
inttype wraps C