__doc__ string for getset members

N

Nick Gnedin

Folks,

I am writing an extension where I follow the guide on the web
(http://docs.python.org/3.3/extending/newtypes.html#generic-attribute-management).
I have an object declared,

struct Object
{
PyObject_HEAD
};

and a member set through tp_getset mechanism,

PyGetSetDef ObjectGetSet[] =
{
{"mem", (getter)MemGet, (setter)MemSet, "mem-doc-string", NULL},
{NULL} /* Sentinel */
};

My question is - how do I access the doc string "mem-doc-string"
supplied in the PyGetSetDef structure? If I type

print(obj.mem.__doc__)

then the __doc__ string for the result of a call to MemGet(...) is
printed, not the doc string supplied in the PyGetSetDef structure.

Many thanks for the advice,

Nick Gnedin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top