summaryrefslogtreecommitdiffstats
path: root/Lib/keyword.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-03-20 19:44:30 (GMT)
committerGuido van Rossum <guido@python.org>1997-03-20 19:44:30 (GMT)
commit90d556fb6e71ca05b14c514b0c9a53a99839a3e0 (patch)
treebbe4c00c55d550f5207113e0772be0456685e459 /Lib/keyword.py
parentf789ee4a8606ef1c34f2f18389b46c9b54ee04ae (diff)
downloadcpython-90d556fb6e71ca05b14c514b0c9a53a99839a3e0.zip
cpython-90d556fb6e71ca05b14c514b0c9a53a99839a3e0.tar.gz
cpython-90d556fb6e71ca05b14c514b0c9a53a99839a3e0.tar.bz2
Simple module to publish list of Python keywords.
Diffstat (limited to 'Lib/keyword.py')
-rwxr-xr-xLib/keyword.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/Lib/keyword.py b/Lib/keyword.py
new file mode 100755
index 0000000..acee8ff
--- /dev/null
+++ b/Lib/keyword.py
@@ -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