mirror of
https://github.com/python/cpython.git
synced 2025-11-28 22:18:54 +00:00
Simple module to publish list of Python keywords.
This commit is contained in:
parent
f789ee4a86
commit
90d556fb6e
1 changed files with 37 additions and 0 deletions
37
Lib/keyword.py
Executable file
37
Lib/keyword.py
Executable file
|
|
@ -0,0 +1,37 @@
|
||||||
|
"""Export the list of Python keywords (reserved words)."""
|
||||||
|
|
||||||
|
# grep '{1, "' ../Python/graminit.c | sed 's/.*"\(.*\)".*/ "\1",/' | sort
|
||||||
|
|
||||||
|
keywords = [
|
||||||
|
"__assert__",
|
||||||
|
"and",
|
||||||
|
"break",
|
||||||
|
"class",
|
||||||
|
"continue",
|
||||||
|
"def",
|
||||||
|
"del",
|
||||||
|
"elif",
|
||||||
|
"else",
|
||||||
|
"except",
|
||||||
|
"exec",
|
||||||
|
"finally",
|
||||||
|
"for",
|
||||||
|
"from",
|
||||||
|
"global",
|
||||||
|
"if",
|
||||||
|
"import",
|
||||||
|
"in",
|
||||||
|
"is",
|
||||||
|
"lambda",
|
||||||
|
"not",
|
||||||
|
"or",
|
||||||
|
"pass",
|
||||||
|
"print",
|
||||||
|
"raise",
|
||||||
|
"return",
|
||||||
|
"try",
|
||||||
|
"while",
|
||||||
|
]
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
for k in keywords: print k
|
||||||
Loading…
Add table
Add a link
Reference in a new issue