[docs] [issue33014] Clarify doc string for str.isidentifier()

David Beazley report at bugs.python.org
Tue Mar 6 10:50:40 EST 2018

New submission from David Beazley <dave at dabeaz.com>:

This is a minor nit, but the doc string for str.isidentifier() states:

    Use keyword.iskeyword() to test for reserved identifiers such as "def" and "class".

At first glance, I thought that it meant you'd do this (doesn't work):


As opposed to this:

    import keyword

Perhaps a clarification that "keyword" refers to the keyword module could be added.   Or better yet, just make 'iskeyword()` a string method ;-).

assignee: docs at python
components: Documentation
messages: 313335
nosy: dabeaz, docs at python
priority: normal
severity: normal
status: open
title: Clarify doc string for str.isidentifier()
versions: Python 3.7

Python tracker <report at bugs.python.org>

More information about the docs mailing list