In .pxd file, I wrote
_Point operator+(const _Point other) const
_Point operator -(const _Point other) const
bool operator==(const _Point other) const
In .pyx file, I wrote
def eq(self, Point other):
cdef _Point* selfptr = self.c_point.get()
cdef _Point* otherptr = other.c_point.get()
return selfptr[0] == otherptr[0]
But it comes to operators like __add__
, I cannot do the same thing like ==
.
def add(self, Point other):
cdef _Point * selfptr = self.c_point.get()
cdef _Point * otherptr = other.c_point.get()
return selfptr[0] + otherptr[0]
Error Message
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [27 lines of output]
Error compiling Cython file:
------------------------------------------------------------
...
return not self.__eq__(other)
def __add__(self, Point other):
cdef _Point * selfptr = self.c_point.get()
cdef _Point * otherptr = other.c_point.get()
return selfptr[0] + otherptr[0]
^
------------------------------------------------------------
src/Geometry/Point/Point.pyx:170:26: Cannot convert '_Point' to Python object
How can I fix this? Thank you