Commit 36239b06 authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2375 from gabrieldemarmiesse/test_pure_11

Adding tests for "pure python mode" part 11
parents 7a9e41e1 261ac12b
import cython
@cython.locals(t=cython.int, i=cython.int)
cpdef int dostuff(int n)
def dostuff(n):
t = 0
for i in range(n):
t += i
return t
......@@ -278,20 +278,13 @@ Magic Attributes within the .pxd
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The special `cython` module can also be imported and used within the augmenting
:file:`.pxd` file. For example, the following Python file :file:`dostuff.py`::
:file:`.pxd` file. For example, the following Python file :file:`dostuff.py`:
def dostuff(n):
t = 0
for i in range(n):
t += i
return t
.. literalinclude:: ../../examples/tutorial/pure/dostuff.py
can be augmented with the following :file:`.pxd` file :file:`dostuff.pxd`::
can be augmented with the following :file:`.pxd` file :file:`dostuff.pxd`:
import cython
@cython.locals(t = cython.int, i = cython.int)
cpdef int dostuff(int n)
.. literalinclude:: ../../examples/tutorial/pure/dostuff.pxd
The :func:`cython.declare()` function can be used to specify types for global
variables in the augmenting :file:`.pxd` file.
......
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