Debian Codegraph @

Doc/library/keyword.rst

raw
1 :mod:`!keyword` --- Testing for Python keywords
2 ===============================================
3
4 .. module:: keyword
5 :synopsis: Test whether a string is a keyword in Python.
6
7 **Source code:** :source:`Lib/keyword.py`
8
9 --------------
10
11 This module allows a Python program to determine if a string is a
12 :ref:`keyword <keywords>` or :ref:`soft keyword <soft-keywords>`.
13
14
15 .. function:: iskeyword(s)
16
17 Return ``True`` if *s* is a Python :ref:`keyword <keywords>`.
18
19
20 .. data:: kwlist
21
22 Sequence containing all the :ref:`keywords <keywords>` defined for the
23 interpreter. If any keywords are defined to only be active when particular
24 :mod:`__future__` statements are in effect, these will be included as well.
25
26
27 .. function:: issoftkeyword(s)
28
29 Return ``True`` if *s* is a Python :ref:`soft keyword <soft-keywords>`.
30
31 .. versionadded:: 3.9
32
33
34 .. data:: softkwlist
35
36 Sequence containing all the :ref:`soft keywords <soft-keywords>` defined for the
37 interpreter. If any soft keywords are defined to only be active when particular
38 :mod:`__future__` statements are in effect, these will be included as well.
39
40 .. versionadded:: 3.9