Commit 883b5c44 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Moved the typed constructor example to the example directory for testing.

parent 5fadf79e
import cython
class A:
cython.declare(a=cython.int, b=cython.int)
def __init__(self, b=0):
self.a = 3
self.b = b
...@@ -168,13 +168,9 @@ Static typing ...@@ -168,13 +168,9 @@ Static typing
cython.declare(x=cython.int, y=cython.double) # cdef int x; cdef double y cython.declare(x=cython.int, y=cython.double) # cdef int x; cdef double y
It can also be used to type class constructors:: It can also be used to type class constructors:
class A: .. literalinclude:: ../../examples/tutorial/pure/class_constructor.py
cython.declare(a=cython.int, b=cython.int)
def __init__(self, b=0):
self.a = 3
self.b = b
And even to define extension type private, readonly and public attributes:: And even to define extension type private, readonly and public attributes::
......
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