aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/keyword.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/keyword.py')
-rwxr-xr-xLib/keyword.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/Lib/keyword.py b/Lib/keyword.py
index 69794bda8c8..dad39cc3779 100755
--- a/Lib/keyword.py
+++ b/Lib/keyword.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
"""Keywords (from "graminit.c")
@@ -14,6 +14,9 @@ __all__ = ["iskeyword", "kwlist"]
kwlist = [
#--start keywords--
+ 'False',
+ 'None',
+ 'True',
'and',
'as',
'assert',
@@ -25,7 +28,6 @@ kwlist = [
'elif',
'else',
'except',
- 'exec',
'finally',
'for',
'from',
@@ -35,10 +37,10 @@ kwlist = [
'in',
'is',
'lambda',
+ 'nonlocal',
'not',
'or',
'pass',
- 'print',
'raise',
'return',
'try',
@@ -59,21 +61,19 @@ def main():
else: optfile = "Lib/keyword.py"
# scan the source file for keywords
- fp = open(iptfile)
- strprog = re.compile('"([^"]+)"')
- lines = []
- for line in fp:
- if '{1, "' in line:
- match = strprog.search(line)
- if match:
- lines.append(" '" + match.group(1) + "',\n")
- fp.close()
+ with open(iptfile) as fp:
+ strprog = re.compile('"([^"]+)"')
+ lines = []
+ for line in fp:
+ if '{1, "' in line:
+ match = strprog.search(line)
+ if match:
+ lines.append(" '" + match.group(1) + "',\n")
lines.sort()
# load the output skeleton from the target
- fp = open(optfile)
- format = fp.readlines()
- fp.close()
+ with open(optfile) as fp:
+ format = fp.readlines()
# insert the lines of keywords
try: