Issue 17447: Clarify that str.isidentifier doesn't check for reserved keywords.
authorRaymond Hettinger <python@rcn.com>
Sat, 23 Mar 2013 15:21:12 +0000 (08:21 -0700)
committerRaymond Hettinger <python@rcn.com>
Sat, 23 Mar 2013 15:21:12 +0000 (08:21 -0700)
Doc/library/stdtypes.rst
Objects/unicodeobject.c

index 7e5f04f6c26f302103bf2fda7333f08f7ec93ccd..60df11d130c92ad0f62a831457cc77e8dd92f77f 100644 (file)
@@ -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()
 
index 9f269a5bc2e9aff0d3afb4fa2100b972414c80ac..c21e80c99d2e7878e3698c16d8a13a6d0578dee3 100644 (file)
@@ -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)