Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43008 > unrolled thread

__doc__ string for getset members

Started byNick Gnedin <ngnedin@gmail.com>
First post2013-04-07 13:02 -0500
Last post2013-04-07 13:02 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  __doc__ string for getset members Nick Gnedin <ngnedin@gmail.com> - 2013-04-07 13:02 -0500

#43008 — __doc__ string for getset members

FromNick Gnedin <ngnedin@gmail.com>
Date2013-04-07 13:02 -0500
Subject__doc__ string for getset members
Message-ID<mailman.246.1365357741.3114.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web