On Jul 27, 4:50 pm, Farshid Lashkari <[EMAIL PROTECTED]> 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?
Interesting. Let me try it again. I definitely want to remove the intermediate step that creates a temporary Py object. Well, Python is probably doing it internally anyway, but at least I don't have to see it. :-) -- http://mail.python.org/mailman/listinfo/python-list