Re: writing a generic method

2005-11-21 Thread jepler
You could use a format like "#s#sO", and then use PyFloat_Check, PyFloat_AsDouble, and the equivalent PyInt macros to get the "C" value out of the Python object. You should be able to use the converter "O&" to get what you want. The conversion function might look like: int double_only(PyO

Re: writing a generic method

2005-11-21 Thread fj
Nice ! Thank you very much : it works well with "s#s#O" And also thank you for your advice to insert PyErr_Clear() when several calls to PyArgParseTuple are performed in the same method. bye FJ -- http://mail.python.org/mailman/listinfo/python-list

writing a generic method

2005-11-21 Thread fj
I am new in Python programming. I try to connect to Python various libraries written either in C of in Fortran. The job is not really hard but I meet a trouble when trying to build up a generic routine like in C++ or F90, i.e. a single routine name for various uses. Here is an example with a Fortr