PyCFunction? What is it?

Courageous jkraska1 at san.rr.com
Tue May 30 03:26:42 EDT 2000


> nope.  when you're implementing methods, the first argument
> is a pointer to an object instance (cast down to a PyObject).
> To get the object pointer, you have to cast it back at some
> point, and some programmers prefer to write:
> 
>     mymethod(MyOwnObject *self, PyObject *args)
>     {
>         ...
>     }
> 
> and put the cast in the method table, than to keep writing
> things like:
> 
>     mymethod(PyObject *self_, PyObject *args)
>     {
>         PyOwnObject* self = (MyOwnObject*) self_;
>         ...
>     }


Ahhh. That explains it. VCC was allowing me to declare
things this way without an explicit cast, but it did
issue warnings. I started doing PyCFunction because I
think I saw it in Guido's code maybe.


C/



More information about the Python-list mailing list