From: Mark Summerfield <l...@qtrac.plus.com>
Date: Fri, 14 Sep 2012 20:54:58 +0100
Local: Fri, Sep 14 2012 3:54 pm
Subject: Re: [cython-users] can pointers be stored in Python's dict or list?
Hi Robert,
On Fri, 14 Sep 2012 10:45:06 -0700
Robert Bradshaw <rober...@gmail.com> wrote:
But that means I have to drop down to C. I want to stay in Python and
> On Fri, Sep 14, 2012 at 8:11 AM, Mark Summerfield <l...@qtrac.plus.com> > wrote: > > Hi, > > (1)
> > I am using Cython to provide a Python wrapper to a C library.
> > I want to be able to store a dictionary of name-pointer pairs so that I
> > This doesn't seem to work with dict or list because of the
> > Right now I have a static array and a dictionary:
> > cdef Thing* pointers[30]
> > but I'd really like to be able to store an arbitrary number of
> > Is this possible?
> Sounds like you want
Cython. I was hoping that Cython offered some kind of wrapper type, something that at the Python level would look like: class Pointer(object):
that could be put in a dict or list. Then I could do things like this:
Pointer p = <void*>c_func_that_returns_a_pointer()
Oh well, I'll see if I can use libcpp's map...
> > (2)
I changed it to printf("%p\n", pointer) and now I get
> > Also, I tried doing
> > from libc.stdio cimport printf
> > and then in my code:
> > printf("%p", pointer)
> > but although it compiled without error, nothing was printed.
> Did it perhaps not flush? You also might want to try adding a newline.
Cannot convert 'void *' to Python object -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||