I have a vector class I have defined in cython, and I am trying to show some of the attributes to users. I want to iterate over them using the __dict__
attribute, but I'm getting an error that my object does not contain that attribute. Is it possible to use the __dict__
attribute on instances of cython defined objects?
For example:
from my_cython_lib import vector
v1 = Vector()
for attrtibute in v1.__dict__:
# do stuff to the attribute
My vector class:
cdef class Vector:
def __cinit__(self):
self.x = None
self.y = None
self.z = None