Kaydet (Commit) 23b5918f authored tarafından Skip Montanaro's avatar Skip Montanaro

add some example docstrings using PyDoc_STR

üst d9e7d245
...@@ -65,17 +65,17 @@ spamlist_specialmeth(PyObject *self, PyObject *args, PyObject *kw) ...@@ -65,17 +65,17 @@ spamlist_specialmeth(PyObject *self, PyObject *args, PyObject *kw)
static PyMethodDef spamlist_methods[] = { static PyMethodDef spamlist_methods[] = {
{"getstate", (PyCFunction)spamlist_getstate, METH_VARARGS, {"getstate", (PyCFunction)spamlist_getstate, METH_VARARGS,
"getstate() -> state"}, PyDoc_STR("getstate() -> state")},
{"setstate", (PyCFunction)spamlist_setstate, METH_VARARGS, {"setstate", (PyCFunction)spamlist_setstate, METH_VARARGS,
"setstate(state)"}, PyDoc_STR("setstate(state)")},
/* These entries differ only in the flags; they are used by the tests /* These entries differ only in the flags; they are used by the tests
in test.test_descr. */ in test.test_descr. */
{"classmeth", (PyCFunction)spamlist_specialmeth, {"classmeth", (PyCFunction)spamlist_specialmeth,
METH_VARARGS | METH_KEYWORDS | METH_CLASS, METH_VARARGS | METH_KEYWORDS | METH_CLASS,
"classmeth(*args, **kw)"}, PyDoc_STR("classmeth(*args, **kw)")},
{"staticmeth", (PyCFunction)spamlist_specialmeth, {"staticmeth", (PyCFunction)spamlist_specialmeth,
METH_VARARGS | METH_KEYWORDS | METH_STATIC, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
"staticmeth(*args, **kw)"}, PyDoc_STR("staticmeth(*args, **kw)")},
{NULL, NULL}, {NULL, NULL},
}; };
...@@ -98,7 +98,7 @@ spamlist_state_get(spamlistobject *self) ...@@ -98,7 +98,7 @@ spamlist_state_get(spamlistobject *self)
static PyGetSetDef spamlist_getsets[] = { static PyGetSetDef spamlist_getsets[] = {
{"state", (getter)spamlist_state_get, NULL, {"state", (getter)spamlist_state_get, NULL,
"an int variable for demonstration purposes"}, PyDoc_STR("an int variable for demonstration purposes")},
{0} {0}
}; };
...@@ -173,9 +173,9 @@ spamdict_setstate(spamdictobject *self, PyObject *args) ...@@ -173,9 +173,9 @@ spamdict_setstate(spamdictobject *self, PyObject *args)
static PyMethodDef spamdict_methods[] = { static PyMethodDef spamdict_methods[] = {
{"getstate", (PyCFunction)spamdict_getstate, METH_VARARGS, {"getstate", (PyCFunction)spamdict_getstate, METH_VARARGS,
"getstate() -> state"}, PyDoc_STR("getstate() -> state")},
{"setstate", (PyCFunction)spamdict_setstate, METH_VARARGS, {"setstate", (PyCFunction)spamdict_setstate, METH_VARARGS,
"setstate(state)"}, PyDoc_STR("setstate(state)")},
{NULL, NULL}, {NULL, NULL},
}; };
...@@ -192,7 +192,7 @@ spamdict_init(spamdictobject *self, PyObject *args, PyObject *kwds) ...@@ -192,7 +192,7 @@ spamdict_init(spamdictobject *self, PyObject *args, PyObject *kwds)
static PyMemberDef spamdict_members[] = { static PyMemberDef spamdict_members[] = {
{"state", T_INT, offsetof(spamdictobject, state), READONLY, {"state", T_INT, offsetof(spamdictobject, state), READONLY,
"an int variable for demonstration purposes"}, PyDoc_STR("an int variable for demonstration purposes")},
{0} {0}
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment