Keyword Functions

keyword.issoftkeyword()

Test whether a spelling has context-sensitive keyword status. A soft keyword can still be an identifier outside its special grammar context.

Formal Syntax & Structure

python syntaxpython
keyword.issoftkeyword(s, /)

Parameters & Attributes

NameTypeDescription
sstrCandidate identifier spelling.

Return Value

bool

The bool result described above.

Working Example

Example Snippetpython
import keywordprint(keyword.issoftkeyword("match"), keyword.issoftkeyword("class"))
Python Reference