Pyrex pointer problem
mike at bindkey.com
Wed Apr 23 20:53:52 CEST 2003
"Edward C. Jones" <edcjones at erols.com> wrote in message
news:b86aio$2b3$1 at bob.news.rcn.net...
> I use Pyrex 0.7.2 and Python 2.2.2. For line "return self.t.as" in
> "wrapped.pyx", I get the error message:
> Cannot convert 'A_Struct' to Python object
> How do I fix this?
You are operating on single-linked list at C level.
Since Python has a notion of list you better consider returning C list as a
whole as Python list or tuple of iVals.
Another approach is to simulate Python list in C with __len__, __getitem__,
__setitem__ and other (mutable) sequence
methods (see http://www.python.org/doc/current/lib/typesseq.html).
Which approach to choose depends on size of the list and intended usage.
More information about the Python-list