Skip to Content
Daniel Arbuckle's Mastering Python
book

Daniel Arbuckle's Mastering Python

by Daniel Arbuckle
June 2017
Beginner to intermediate
274 pages
6h 49m
English
Packt Publishing
Content preview from Daniel Arbuckle's Mastering Python

Writing extension modules in Cython

The num_values variable in the previous code example is just a chunk of memory that stores bits that represent an integer value. It doesn't have any of the extra data needed to turn it into a Python object.

This is a bad thing in a way because it means that Python can't do any of the smart things it does to help us write good code quickly.We wouldn't be working with these tools if we didn't have a reason to let them do some of this work for us.

So, to resolve this, let's define an extension type called StatisticalArray (refer to the following code example), which contains a pointer to a memory location and two integers. The memory location is supposed to contain double-precision floating point numbers. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Deep Learning for Games

Hands-On Deep Learning for Games

Micheal Lanham
Mastering PyCharm

Mastering PyCharm

Nafiul Islam
Python: Journey from Novice to Expert

Python: Journey from Novice to Expert

Fabrizio Romano, Dusty Phillips, Rick van Hattem

Publisher Resources

ISBN: 9781787283695Supplemental Content