OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Cython struct with list attribute

  • Thread starter Thread starter John
  • Start date Start date
J

John

Guest
I am trying to make a struct in Cython which has a list as a member. This is not allowed, since when I try to compile:

Code:
cdef struct CloseValues:
    int size
    list values
    list ks

I get the error C struct/union member cannot be a Python object.

Is there a C/Cpp alternative for this, which is also efficient and can be defined without specifying its size?
<p>I am trying to make a struct in Cython which has a list as a member. This is not allowed, since when I try to compile:</p>
<pre><code>cdef struct CloseValues:
int size
list values
list ks
</code></pre>
<p>I get the error <code>C struct/union member cannot be a Python object</code>.</p>
<p>Is there a C/Cpp alternative for this, which is also efficient and can be defined without specifying its size?</p>
 

Latest posts

I
Replies
0
Views
1
impact christian
I
Top