New submission from David Beazley <>:

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 

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@python
components: Documentation
messages: 313335
nosy: dabeaz, docs@python
priority: normal
severity: normal
status: open
title: Clarify doc string for str.isidentifier()
versions: Python 3.7

Python tracker <>
Python-bugs-list mailing list

Reply via email to