Commit 60ae2777 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Moved the second code snippet from cdef_classes.rst to the examples directory...

Moved the second code snippet from cdef_classes.rst to the examples directory to add it to the tests.
parent 5fadf79e
cdef class Function:
cpdef double evaluate(self, double x) except *:
return 0
...@@ -33,11 +33,9 @@ Cython code and pure Python code. ...@@ -33,11 +33,9 @@ Cython code and pure Python code.
So far our integration example has not been very useful as it only So far our integration example has not been very useful as it only
integrates a single hard-coded function. In order to remedy this, integrates a single hard-coded function. In order to remedy this,
with hardly sacrificing speed, we will use a cdef class to represent a with hardly sacrificing speed, we will use a cdef class to represent a
function on floating point numbers:: function on floating point numbers:
cdef class Function: .. literalinclude:: ../../examples/tutorial/cdef_classes/math_function_2.pyx
cpdef double evaluate(self, double x) except *:
return 0
The directive cpdef makes two versions of the method available; one The directive cpdef makes two versions of the method available; one
fast for use from Cython and one slower for use from Python. Then:: fast for use from Cython and one slower for use from Python. Then::
......
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