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",
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.
>
> Tha
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.
>
> Tha
On Jul 27, 11:37 am, Farshid Lashkari <[EMAIL PROTECTED]> wrote:
> beginner wrote:
> > This works with PyFloat only. It does not work with integers.
>
> Did you try it out? I have used it on ints, bools, and objects that
> implement the __float__ method. It does not work on strings though.
I did a
beginner wrote:
> This works with PyFloat only. It does not work with integers.
Did you try it out? I have used it on ints, bools, and objects that
implement the __float__ method. It does not work on strings though.
--
http://mail.python.org/mailman/listinfo/python-list
Hi Farshid,
On Jul 26, 8:18 pm, Farshid Lashkari <[EMAIL PROTECTED]> wrote:
> beginner wrote:
> > 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?
>
> Try using the PyFloat_A
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
beginner wrote:
> 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?
Try using the PyFloat_AsDouble(...) function, it should be able to
convert an object to a double, as long as t
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
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
10 matches
Mail list logo