Skip to content

Commit 1cb2300

Browse files
bpo-33014: Clarify str.isidentifier docstring
1 parent 5d2a27d commit 1cb2300

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Doc/library/stdtypes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,8 +1687,8 @@ expression support in the :mod:`re` module).
16871687
Return true if the string is a valid identifier according to the language
16881688
definition, section :ref:`identifiers`.
16891689

1690-
Use :func:`keyword.iskeyword` to test for reserved identifiers such as
1691-
:keyword:`def` and :keyword:`class`.
1690+
Call :func:`keyword.iskeyword` to test whether string ``s`` is a reserved
1691+
identifier, such as :keyword:`def` and :keyword:`class`.
16921692

16931693
.. method:: str.islower()
16941694

Objects/clinic/unicodeobject.c.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ PyDoc_STRVAR(unicode_isidentifier__doc__,
381381
"\n"
382382
"Return True if the string is a valid Python identifier, False otherwise.\n"
383383
"\n"
384-
"Use keyword.iskeyword() to test for reserved identifiers such as \"def\" and\n"
385-
"\"class\".");
384+
"Call keyword.iskeyword(s) to test whether string s is a reserved identifier,\n"
385+
"such as \"def\" or \"class");
386386

387387
#define UNICODE_ISIDENTIFIER_METHODDEF \
388388
{"isidentifier", (PyCFunction)unicode_isidentifier, METH_NOARGS, unicode_isidentifier__doc__},
@@ -951,4 +951,4 @@ unicode_sizeof(PyObject *self, PyObject *Py_UNUSED(ignored))
951951
{
952952
return unicode_sizeof_impl(self);
953953
}
954-
/*[clinic end generated code: output=561c88c912b8fe3b input=a9049054013a1b77]*/
954+
/*[clinic end generated code: output=c9476bf19f13c286 input=a9049054013a1b77]*/

Objects/unicodeobject.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12069,13 +12069,13 @@ str.isidentifier as unicode_isidentifier
1206912069
1207012070
Return True if the string is a valid Python identifier, False otherwise.
1207112071
12072-
Use keyword.iskeyword() to test for reserved identifiers such as "def" and
12073-
"class".
12072+
Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
12073+
such as "def" or "class
1207412074
[clinic start generated code]*/
1207512075

1207612076
static PyObject *
1207712077
unicode_isidentifier_impl(PyObject *self)
12078-
/*[clinic end generated code: output=fe585a9666572905 input=916b0a3c9f57e919]*/
12078+
/*[clinic end generated code: output=fe585a9666572905 input=2fb643aafbcf0e1c]*/
1207912079
{
1208012080
return PyBool_FromLong(PyUnicode_IsIdentifier(self));
1208112081
}

0 commit comments

Comments
 (0)