getting float from PyObject

Gerhard Häring gh at ghaering.de
Mon Nov 24 05:00:24 EST 2003


Boštjan Jerko wrote:
> Is there a way to get C float from PyObject (in C extension)?

No.

You get get a C double, though ;)

/* Extract C double from Python float.  The macro version trades safety 
for speed. */
extern DL_IMPORT(double) PyFloat_AsDouble(PyObject *);

Found with grepping for Float in the Python headers directory ;)

-- Gerhard






More information about the Python-list mailing list