diff options
Diffstat (limited to 'docs/examples/tutorial/cdef_classes/wave_function.pyx')
-rw-r--r-- | docs/examples/tutorial/cdef_classes/wave_function.pyx | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/docs/examples/tutorial/cdef_classes/wave_function.pyx b/docs/examples/tutorial/cdef_classes/wave_function.pyx index aa35d954e..34b144667 100644 --- a/docs/examples/tutorial/cdef_classes/wave_function.pyx +++ b/docs/examples/tutorial/cdef_classes/wave_function.pyx @@ -1,21 +1,22 @@ -from sin_of_square cimport Function
-
-cdef class WaveFunction(Function):
-
- # Not available in Python-space:
- cdef double offset
-
- # Available in Python-space:
- cdef public double freq
-
- # Available in Python-space, but only for reading:
- cdef readonly double scale
-
- # Available in Python-space:
- @property
- def period(self):
- return 1.0 / self.freq
-
- @period.setter
- def period(self, value):
- self.freq = 1.0 / value
+from sin_of_square cimport Function + + +cdef class WaveFunction(Function): + + # Not available in Python-space: + cdef double offset + + # Available in Python-space: + cdef public double freq + + # Available in Python-space, but only for reading: + cdef readonly double scale + + # Available in Python-space: + @property + def period(self): + return 1.0 / self.freq + + @period.setter + def period(self, value): + self.freq = 1.0 / value |