Commit 36dfbbca authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2330 from gabrieldemarmiesse/test_cdef_classes_2

Added tests for cdef_classes.rst. Part 2.
parents 28bb1ffd 60ae2777
cdef class Function:
cpdef double evaluate(self, double x) except *:
return 0
......@@ -27,11 +27,9 @@ Cython code and pure Python code.
So far our integration example has not been very useful as it only
integrates a single hard-coded function. In order to remedy this,
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:
cpdef double evaluate(self, double x) except *:
return 0
.. literalinclude:: ../../examples/tutorial/cdef_classes/math_function_2.pyx
The directive cpdef makes two versions of the method available; one
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