Commit 1fc7e64c authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Put the code example from "pure python mode" in a file in the examples directory for testing.

parent 5fadf79e
cpdef int myfunction(int x, int y=2):
a = x - y
return a + x * y
cdef double _helper(double a):
return a + 1
cdef class A:
cdef public int a, b
def __init__(self, b=0):
self.a = 3
self.b = b
cpdef foo(self, double x):
print(x + _helper(1.0))
......@@ -68,23 +68,9 @@ and adds :file:`A.pxd`::
cdef public int a,b
cpdef foo(self, double x)
then Cython will compile the :file:`A.py` as if it had been written as follows::
then Cython will compile the :file:`A.py` as if it had been written as follows:
cpdef int myfunction(int x, int y=2):
a = x-y
return a + x * y
cdef double _helper(double a):
return a + 1
cdef class A:
cdef public int a,b
def __init__(self, b=0):
self.a = 3
self.b = b
cpdef foo(self, double x):
print(x + _helper(1.0))
.. literalinclude:: ../../examples/tutorial/pure/A_equivalent.pyx
Notice how in order to provide the Python wrappers to the definitions
in the :file:`.pxd`, that is, to be accessible from Python,
......
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