Commit 853e8c6c authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2335 from gabrieldemarmiesse/pure_python_mode_2

Adding tests for "pure python mode" part 2
parents f29ae73c 1fc7e64c
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))
...@@ -50,23 +50,9 @@ and adds :file:`A.pxd`: ...@@ -50,23 +50,9 @@ and adds :file:`A.pxd`:
.. literalinclude:: ../../examples/tutorial/pure/A.pxd .. literalinclude:: ../../examples/tutorial/pure/A.pxd
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): .. literalinclude:: ../../examples/tutorial/pure/A_equivalent.pyx
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))
Notice how in order to provide the Python wrappers to the definitions Notice how in order to provide the Python wrappers to the definitions
in the :file:`.pxd`, that is, to be accessible from Python, 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