tp_members vs. tp_getset slots

jsaul jsaul at gmx.de
Thu Dec 5 12:24:09 EST 2002


Hi there,

I am writing a C extension module which shall export classes that
can be inherited from within python. After a lot of confusion and
frustration due to (sorry to say) lack of documentation I found a
solution that seems to suit my needs. Namely, by defining the
tp_members and tp_getset slots.

But what is the actual difference (not just syntactically) between
tp_members and tp_getset (if any)? When to use one and when to use
the other?

It seems to me they are largely interchanchable; tp_members for
the 'simple cases' (definition/access of/to basetypes, and Python
objects without type check) whereas tp_getset is for the cases
that require special treatment, e.g. type checks etc. But I may
be wrong, so I'd be glad for any clarification.

Cheers, jsaul
-- 
Que le gusta rrrodarrr la errre.



More information about the Python-list mailing list