Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 51612fd

Browse files
committed
merge
2 parents cf936c7 + 378170d commit 51612fd

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Doc/library/stdtypes.rst

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

1630+
Use :func:`keyword.iskeyword` to test for reserved identifiers such as
1631+
:keyword:`def` and :keyword:`class`.
16301632

16311633
.. method:: str.islower()
16321634

Objects/unicodeobject.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11369,7 +11369,10 @@ PyDoc_STRVAR(isidentifier__doc__,
1136911369
"S.isidentifier() -> bool\n\
1137011370
\n\
1137111371
Return True if S is a valid identifier according\n\
11372-
to the language definition.");
11372+
to the language definition.\n\
11373+
\n\
11374+
Use keyword.iskeyword() to test for reserved identifiers\n\
11375+
such as \"def\" and \"class\".\n");
1137311376

1137411377
static PyObject*
1137511378
unicode_isidentifier(PyObject *self)

0 commit comments

Comments
 (0)