During a Cython meetup a speaker pointed to other data types such as cython.ssize_t
. The type ssize_t
is briefly mentioned in this Wikipedia article however it is not well explained. Similarly Cython documentation mentions types in terms of how types are automatically converted.
What are all the data types available in Cython and what are their specifications?
You have basically access to most of the C types:
Here are the equivalent of all the Python types (if I do not miss some), taken from Oreilly book cython book
Python bool
:
Python int
and long
Python float
Python complex
Python bytes
/ str
/ unicode
For the size_t
and Py_ssite_t
, keep in mind these are aliases.
Py_ssize_t
is defined in python.h
imported implicitly in cython. That can hold the size (in bytes) of the largest object the Python interpreter ever creates.
While size_t
is a standard C89 type, defined in <stddef.h>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With