[capi-sig] Python to Scheme type conversion in C?
amnorvend at gmail.com
Mon May 31 18:15:34 CEST 2010
I'm working on a Python-to-mzscheme binding using mzscheme's ffi
library (mzscheme's rough equivalent of the Python ctypes library).
I'm looking for a way to convert Python objects into Scheme values.
Essentially what I'm trying to do is say "Is this a Python integer?
Ok, convert it to a Scheme integer." or "Is this a Python string?
Ok, convert it into a Scheme string." ... etc.
What is the best way to do this? My first intuition was to call
Py*_Check to determine the type, but it turns out that's a macro that
can't be used in non-c code. I'm sure I could translate that into the
appropriate C code, but that gives me a bad feeling. Right now, I'm
looking for simple and easy more than efficient and complete (but I
would also like to know what the efficient and complete approach would
Can anyone tell me what the best way to tackle this problem is?
More information about the capi-sig