Hi Robert,

On Jul 26, 8:16 pm, Robert Kern <[EMAIL PROTECTED]> wrote:
> beginner wrote:
> > Hi,
>
> > I run into another C API question. What is the simplest way to convert
> > an PyObject into a double?
>
> > For example, I have
>
> >  PyObject *obj;
>
> > I know obj is a number, but I do not know the exact type. How can I
> > convert it to double without writing a giant switch() that exhausts
> > every single type of number?
>
> Convert it to a Python float using PyNumber_Float(), then use 
> PyFloat_AsDouble()
> to get the C double value from it.
>

Thanks a lot for your help.

Best regards,
beginner


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to