Commit cb13a197 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Moved a code snippet from the pure.rst to the examples directory. Fixed a small bug.

parent 5c04c1a8
import cython
@cython.locals(a=cython.long, b=cython.long, n=cython.longlong)
def foo(a, b, x, y):
n = a * b
# ...
...@@ -140,12 +140,9 @@ Static typing ...@@ -140,12 +140,9 @@ Static typing
e = cython.declare(cython.int, 5, visibility='readonly') e = cython.declare(cython.int, 5, visibility='readonly')
* ``@cython.locals`` is a decorator that is used to specify the types of local * ``@cython.locals`` is a decorator that is used to specify the types of local
variables in the function body (including the arguments):: variables in the function body (including the arguments):
@cython.locals(a=cython.double, b=cython.double, n=cython.p_double) .. literalinclude:: ../../examples/tutorial/pure/locals.py
def foo(a, b, x, y):
n = a*b
...
* ``@cython.returns(<type>)`` specifies the function's return type. * ``@cython.returns(<type>)`` specifies the function's return type.
......
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