[Python-Dev] Anyone have a Universal setter example?

Robert Steckroth robertsteckroth at gmail.com
Fri Oct 26 23:01:09 CEST 2012


Hello Gang, I am fresh to this list so, hello PYC gurus!
------------------------------------------------------------------------------
I have been getting into
the Python C API over the past few days and found it it to be a
wonderful framework with
a solid design. There are many questions I would like to pose and
answer in this community and
look forward to a productive relationship. Here are a few question I have:

1. Is it appropriate to post usage questions regarding the Python C
API to this list like the questions below?

2. Is there any examples of a universal setter function for
`PyGetSetDef`? The docs mention using
the closure pointer from the last element in the `PyGetSetDef`
structures. I am finding it hard
to get a grasp on how this is implemented. I understand why we use it
and what it does and
need a more modular setter function for a large object.

*From the docs* [http://docs.python.org/extending/newtypes.html]
> `The getter function is passed a Noddy object and a “closure”, which is void pointer. In this case, the closure is ignored. (The closure supports an advanced usage in which definition data is passed to the getter and setter. This could, for example, be used to allow a single set of getter and setter functions that decide the attribute to get or set based on data in the closure.)`


3. Is it customary to use header files when building larger Python
modules/objects? I was successful in prototyping the source files,
but unable to get the module working after running a distutils
install. In short, is it encouraged to use header files?





-- 
Bust0ut, Surgemcgee: Systems Engineer ---
surgemcgee.com
Django_Teamplate3d


More information about the Python-Dev mailing list