Import the keyword module instead of relying on our own list of

reserved words.  No longer need to import string.
This commit is contained in:
Guido van Rossum 2001-12-04 20:39:36 +00:00
parent 41c6719fe4
commit 4ed6be7107

View file

@ -1,20 +1,11 @@
"""Spit out the Python reserved words table.""" """Spit out the Python reserved words table."""
import string import keyword
raw_words = """
and del for is raise
assert elif from lambda return
break else global not try
class except if or while
continue exec import pass
def finally in print
"""
ncols = 5 ncols = 5
def main(): def main():
words = string.split(raw_words) words = keyword.kwlist[:]
words.sort() words.sort()
colwidth = 1 + max(map(len, words)) colwidth = 1 + max(map(len, words))
nwords = len(words) nwords = len(words)