Commit 3e94f893 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse Committed by gabrieldemarmiesse

Fixed an example in the documentation.

parent 084a25f5
import cython
@cython.cclass
class A:
cython.declare(a=cython.int, b=cython.int)
c = cython.declare(cython.int, visibility='public')
d = cython.declare(cython.int) # private by default.
e = cython.declare(cython.int, visibility='readonly')
def __init__(self, a, b, c, d=5, e=3):
self.a = a
self.b = b
self.c = c
self.d = d
self.e = e
......@@ -130,14 +130,9 @@ Static typing
.. literalinclude:: ../../examples/tutorial/pure/cython_declare2.py
It can also be used to define extension type private, readonly and public attributes::
@cython.cclass
class A:
cython.declare(a=cython.int, b=cython.int)
c = cython.declare(cython.int, visibility='public')
d = cython.declare(cython.int, 5) # private by default.
e = cython.declare(cython.int, 5, visibility='readonly')
It can also be used to define extension type private, readonly and public attributes:
.. literalinclude:: ../../examples/tutorial/pure/cclass.py
* ``@cython.locals`` is a decorator that is used to specify the types of local
variables in the function body (including the arguments):
......
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