[Python-checkins] cpython (3.3): Issue 17447: Clarify that str.isidentifier doesn't check for reserved keywords.

raymond.hettinger python-checkins at python.org
Sat Mar 23 16:22:20 CET 2013


http://hg.python.org/cpython/rev/a7fe48dfbfe9
changeset:   82911:a7fe48dfbfe9
branch:      3.3
parent:      82903:fa9e189e30ad
user:        Raymond Hettinger <python at rcn.com>
date:        Sat Mar 23 08:21:12 2013 -0700
summary:
  Issue 17447:  Clarify that str.isidentifier doesn't check for reserved keywords.

files:
  Doc/library/stdtypes.rst |  2 ++
  Objects/unicodeobject.c  |  5 ++++-
  2 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -1627,6 +1627,8 @@
    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()
 
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -11493,7 +11493,10 @@
              "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)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list