Created
April 8, 2015 22:26
-
-
Save hainm/c7bfcbe504b1dc6bd3cf to your computer and use it in GitHub Desktop.
cython settter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cdef class MyTest (object): | |
cdef public object _x | |
def __cinit__(self): | |
self._x = 0 | |
@property | |
def x(self): | |
return self._x | |
@x.setter | |
def x(self, value): | |
self._x = value | |
# property x: | |
# def __get__(self): | |
# return self._x | |
# def __set__(self, value): | |
# self._x = value | |
t = MyTest() | |
print (t.x) | |
t.x = 100. | |
print (t.x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment