[CentralOH] New Types

Daniel 'Dang' Griffith pythondevdang at lazytwinacres.net
Thu Jun 14 13:04:38 CEST 2007


I definitely don't know the answer. Have you tried posting to comp.lang.python?
For a while, I was reading the pythondev mailing list, and there was quite a
bit about PyObjects and such, but they were working at a lower level. I would
try comp.lang.python first, and then maybe subscribe to the pythondev
mailing list and send a question there.
Isn't PyObject used for interfacing with C/non-Python code? What kind of
fun are you up to?
     --dang
At 06:00 AM 6/14/2007, centraloh-request at python.org wrote:
>Date: Wed, 13 Jun 2007 17:22:32 -0400
>From: David Car <david.car at earthlink.net>
>Subject: [CentralOH] New Types
>I have a question about new types in Python.  Just finished reading up and
>trying a few things out, but I'm a little confused about one thing.  When
>declaring a new type, we basically have two new structures.  One is the per
>instance structure (your PyObject structure), which is basically an expansion
>of the PyObject structure.  At the beginning of that structure is the macro
>declaration of PyObject_HEAD which contains the reference counter and a
>pointer to the new type which is a structure of _typeobject.  Then for your
>new type (i.e. your _typeobject structure) there is a place holder for the
>size of your per instance PyObject structure along with all the necessary
>function pointers your new type will support.  My question is this:  Where
>and when does the pointer in your per instance PyObject structure get set?
>How does the interpreter know that your PyObject structure is related to your
>PyTypeObject structure?  Since your PyObject structure naming convention is
>not tied to your PyTypeObject name, how are the two associated?  I see how
>your type is statically instantiated in the initialization, but I don't see
>where your per instance PyObject is related to it?  Is it simply that the two
>structures co-exist in the same module?  Thanks.



More information about the CentralOH mailing list