[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):

    'def'.iskeyword()

As opposed to this:

    import keyword
    keyword.iskeyword('def')

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>
<https://bugs.python.org/issue33014>
_______________________________________


More information about the docs mailing list