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. -- http://mail.python.org/mailman/listinfo/python-list