Commit 296a297b authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2398 from gabrieldemarmiesse/test_extension_types_2

Added tests to "Extension types" part 2
parents 3d61a95d e5cbf651
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. ...@@ -48,11 +48,9 @@ first method, but Cython code can use either method.
By default, extension type attributes are only accessible by direct access, By default, extension type attributes are only accessible by direct access,
not Python access, which means that they are not accessible from Python code. 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 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: .. literalinclude:: ../../examples/userguide/extension_types/python_access.pyx
cdef public int width, height
cdef readonly float depth
makes the width and height attributes readable and writable from Python code, makes the width and height attributes readable and writable from Python code,
and the depth attribute readable but not writable. 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