mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
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:
parent
41c6719fe4
commit
4ed6be7107
1 changed files with 2 additions and 11 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue