Kaydet (Commit) 378170d5 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Issue 17447: Clarify that str.isidentifier doesn't check for reserved keywords.

üst daa42c77
......@@ -1627,6 +1627,8 @@ expression support in the :mod:`re` module).
Return true if the string is a valid identifier according to the language
definition, section :ref:`identifiers`.
Use :func:`keyword.iskeyword` to test for reserved identifiers such as
:keyword:`def` and :keyword:`class`.
.. method:: str.islower()
......
......@@ -11493,7 +11493,10 @@ PyDoc_STRVAR(isidentifier__doc__,
"S.isidentifier() -> bool\n\
\n\
Return True if S is a valid identifier according\n\
to the language definition.");
to the language definition.\n\
\n\
Use keyword.iskeyword() to test for reserved identifiers\n\
such as \"def\" and \"class\".\n");
static PyObject*
unicode_isidentifier(PyObject *self)
......
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