extending questions

Jim Meier fatjim at home.com
Mon Apr 12 12:27:58 EDT 1999


I have two questions, one simple, one a little bit whiny.

Firstly, I'm looking for a quick and easy way for a PyCFunction to
accept as an argument either an integer or a floating point number, so
that the function can be called as

  func(1,1,1)

or as

  func(0.5,0,2/3)

because python doesn't seem to let me consider an integer as a float.
I've tried using some of the conversion functions in the abstract
numeric suite and the PyFloat_GetDouble (or some similar name), but with
no luck - it always returned -1 for me. Any ideas?

Also, ust a suggestion, but would it be possible to add a
PyNumber_GetDouble(PyObject*n) function to the absract numberic
interface? This would be useful for this sort of situation.

My second question is, is there any work being done towards
updating/completing "Extending and Embedding" and "The Python C API" in
the standard documentation? As it is, the C API is just barely
useful.Wonderfully written, though. So can anyone offer a guess on when
peeking in the source will be mostly outmoded?

Anyways, thanks in advance for your help.
Jim Meier.





More information about the Python-list mailing list