Commit e5cbf651 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Moved an example from extension_types.rst to the examples directory.

parent b9f7a142
cdef class Shrubbery:
cdef public int width, height
cdef readonly float depth
......@@ -48,11 +48,9 @@ first method, but Cython code can use either method.
By default, extension type attributes are only accessible by direct access,
not Python access, which means that they are not accessible from Python code.
To make them accessible from Python code, you need to declare them as
:keyword:`public` or :keyword:`readonly`. For example::
:keyword:`public` or :keyword:`readonly`. For example:
cdef class Shrubbery:
cdef public int width, height
cdef readonly float depth
.. literalinclude:: ../../examples/userguide/extension_types/python_access.pyx
makes the width and height attributes readable and writable from Python code,
and the depth attribute readable but not writable.
......
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