Another C API Question

beginner zyzhu2000 at gmail.com
Sat Jul 28 00:16:47 CEST 2007


On Jul 27, 4:50 pm, Farshid Lashkari <n... at spam.com> wrote:
> beginner wrote:
> > I did and it did not seem to work. I ended up doing the following.
> > Verbose, isn't it?
> > If I do d=PyFloat_AsDouble(oDiscount); in the third "if", I get an
> > error. Maybe I missed something obvious.
>
> That's strange. I just tried the following code:
>
> fprintf(stdout,"True = %lf\n",PyFloat_AsDouble(Py_True));
> fprintf(stdout,"False = %lf\n",PyFloat_AsDouble(Py_False));
> fprintf(stdout,"5 = %lf\n",PyFloat_AsDouble(PyInt_FromLong(5)));
>
> And it printed the following:
>
> True = 1.000000
> False = 0.000000
> 5 = 5.000000
>
> What version of Python are you using?

I am using 2.5.1 and Windows XP. Thanks for your help.




More information about the Python-list mailing list