Hi, I'm trying to use PyFunction_New() function but I've problem finding out how it works. What I'm trying to do is to create python function on the fly and then trying to create function object from if via PyFunction_New.
My problems are similar to this:
http://article.gmane.org/gmane.comp.python.general/548300/match=pyfunction_n...
Please CC me.
thanks
Trigve
Hi there, I never used PyFunction_New() If you can make the code object on the fly this should be no problem.
I have only used PyCFunction_New(), you can set "self" to be any PyObject you like (or a tuple of them) Then your C function will get self as an argument, which can be different for every instance of your PyCFunction and decide what to do based on that.
The main problem with PyCFunction_New is that your tied to predefined C functions.
Another option is to define your own callable PyType.
Sorry I didn't really answer your question but maybe this helps still.
On Mon, Apr 6, 2009 at 8:58 AM, Trigve Siver trigves@yahoo.com wrote:
Hi, I'm trying to use PyFunction_New() function but I've problem finding out how it works. What I'm trying to do is to create python function on the fly and then trying to create function object from if via PyFunction_New.
My problems are similar to this:
http://article.gmane.org/gmane.comp.python.general/548300/match=pyfunction_n...
Please CC me.
thanks
Trigve
capi-sig mailing list capi-sig@python.org http://mail.python.org/mailman/listinfo/capi-sig
--
- Campbell
participants (2)
-
Campbell Barton
-
Trigve Siver