[capi-sig] Getting Numbers in C

Campbell Barton cbarton at metavr.com
Sat Jul 21 05:06:16 CEST 2007

After all that!

I should have looked at the source earlier but BOTH PyFloat_AsDouble and 
PyNumber_Float support the PyNumber protocol, the ONLY difference is 
PyNumber_Float will convert a string "0.01".

It would be good if sombody on this list could update API docs, Iv 
mailed some small doc additions to the suggested address for doc updates 
but no reply.


The following additions could be made to...
   double PyFloat_AsDouble(	PyObject *pyfloat)

This function will also work with a PyInt or any type that implements 
the PyNumber protocol's (tp_as_number->nb_float) function.

   double PyFloat_AS_DOUBLE(	PyObject *pyfloat)
This function will only work with PyFloat or a subtype of PyFloat.

More information about the capi-sig mailing list