I have seen a code which used this way for defining a property
property sockets:
def __get__(self):
cdef list sockets = []
does it have any difference with declaring it with a decorator?
The __get__
and et al way of defining property functions is legacy syntax and deprecated in favour of the @property
decorators - per docs:
There is also a special (deprecated) legacy syntax for defining properties in an extension class:
cdef class Spam:
property cheese:
The code generated by Cython is functionally equivalent and can be seen by examining the C files but the syntax is legacy, deprecated and may be removed in future Cython versions.