Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 90d556f

Browse files
committed
Simple module to publish list of Python keywords.
1 parent f789ee4 commit 90d556f

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lib/keyword.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""Export the list of Python keywords (reserved words)."""
2+
3+
# grep '{1, "' ../Python/graminit.c | sed 's/.*"\(.*\)".*/ "\1",/' | sort
4+
5+
keywords = [
6+
"__assert__",
7+
"and",
8+
"break",
9+
"class",
10+
"continue",
11+
"def",
12+
"del",
13+
"elif",
14+
"else",
15+
"except",
16+
"exec",
17+
"finally",
18+
"for",
19+
"from",
20+
"global",
21+
"if",
22+
"import",
23+
"in",
24+
"is",
25+
"lambda",
26+
"not",
27+
"or",
28+
"pass",
29+
"print",
30+
"raise",
31+
"return",
32+
"try",
33+
"while",
34+
]
35+
36+
if __name__ == '__main__':
37+
for k in keywords: print k

0 commit comments

Comments
 (0)