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_AsDouble(...) function, it should be able to > convert an object to a double, as long as the object implements the > __float__ method.
This works with PyFloat only. It does not work with integers. Thanks, b -- http://mail.python.org/mailman/listinfo/python-list