function return -> input parameter

Benjamin Tai bt98 at doc.ic.ac.uk
Mon Nov 19 22:31:09 CET 2001


Hi,

I am not certain if I cam extend recursive C function call using Python.

Image I want to construct a link list of alphabet implemented in C:

Alphabet A, B, C, D;
setNext( A, B );

It would be the same as saying:

setNext( A, getPrev(C) );

"getPrev(C)" returns B, the right type and answer for A. I could also
say:

setNext( A, getPrev(getPrev(D)) );

"getPrev(D)" retuns C, recursively returns B.

I am getting confused when I am trying to extend the above:
1) Can I distinguish the calls and how? One should be using
"PyArg_Parse()", and the other using "PyEval_CallObject()".
2) The 2nd argument of function "PyEval_CallObject()" is expecting a
Python argument object. What if it is a recursive call? How can I
construct this argument which is a function call itself?


Thanks in advance.

Ben




More information about the Python-list mailing list