]> granicus.if.org Git - python/commitdiff
Import the keyword module instead of relying on our own list of
authorGuido van Rossum <guido@python.org>
Tue, 4 Dec 2001 20:39:36 +0000 (20:39 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 4 Dec 2001 20:39:36 +0000 (20:39 +0000)
reserved words.  No longer need to import string.

Doc/ref/reswords.py

index 22c3bb850e5fad3ca7735ae79d2b1ea45e894b07..29f326fe2ca805c2bd0b857a874707d0f7e7a928 100644 (file)
@@ -1,20 +1,11 @@
 """Spit out the Python reserved words table."""
 
-import string
-
-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              
-"""
+import keyword
 
 ncols = 5
 
 def main():
-    words = string.split(raw_words)
+    words = keyword.kwlist[:]
     words.sort()
     colwidth = 1 + max(map(len, words))
     nwords = len(words)