[Cython] Storing many, many instances
Dag Sverre Seljebotn
dagss at student.matnat.uio.no
Tue May 5 06:39:26 CEST 2009
> Stéfan van der Walt wrote:
>> I think I may have to switch to structs instead of classes, but then I
>> no longer have convenient methods or array members. Maybe I should
>> rewrite my class to have many static methods that operate on a struct,
>> and then collect the structs as data instead of the full instances.
>
> Technically it would not be too difficult to allow
>
> cdef struct MyStruct:
> void foo(self):
> # self is pure MyStruct, perhaps stack-allocated
>
> in Cython, and transform
>
> mystructinstance.foo()
>
> into
>
> __mangled_MyStruct_foo(mystructinstance)
Sorry, it should be MyStruct* as self, and one would transform a call into
__mangled_MyStruct_foo(&mystructinstance)
Dag Sverre
More information about the Cython-dev
mailing list