Defining Python class methods in C
Bryan
belred1 at yahoo.com
Sun Mar 23 20:37:03 EST 2003
sjmachin at lexicon.net (John Machin) wrote in message news:<3e7e1f4c.3072417 at news.lexicon.net>...
> On 23 Mar 2003 06:42:26 -0800, belred1 at yahoo.com (Bryan) wrote:
>
> >thank you both for your help.
>
> You're welcome.
>
>
> > i take it from
> >john's posting, that classes are uses to be compatible with older
> >versions of python.
>
> I don't know where you got that idea, or even what you mean by that.
> In fact there are two kinds of classes, classic and new. See this:
>
> http://www.python.org/doc/2.2.1/whatsnew/
>
> Cheers,
> John
hmmm... i don't know where i got that idea either... sorry about that.
i know the difference between classic and new classes on the python
side. i'm just not clear from the c side. are c types equivalent to
python classic classes and c classes equivalent to python new classes?
anyways, the type was definitely the functionality that i wanted... c
setting of the type object with encapsulated data, sending it to
python which callsback with methods executing in c that can retrieve
the data stored in self. it was interesting that with types, my self
variable has the correct value. but when i was using the class style,
self was always NULL and the first value of args was the type. seems
bizarre to me. i hope one day someone will write an entire book on
the python c api just like there are several books on java's JNI.
bryan
More information about the Python-list
mailing list