[Python-checkins] CVS: python/dist/src/Doc/ref reswords.py,1.1,1.2

Guido van Rossum gvanrossum@users.sourceforge.net
2001年12月04日 12:39:38 -0800


Update of /cvsroot/python/python/dist/src/Doc/ref
In directory usw-pr-cvs1:/tmp/cvs-serv24963
Modified Files:
	reswords.py 
Log Message:
Import the keyword module instead of relying on our own list of
reserved words. No longer need to import string.
Index: reswords.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ref/reswords.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** reswords.py	1997年05月08日 23:21:48	1.1
--- reswords.py	2001年12月04日 20:39:36	1.2
***************
*** 1,19 ****
 """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 
! """
 
 ncols = 5
 
 def main():
! words = string.split(raw_words)
 words.sort()
 colwidth = 1 + max(map(len, words))
--- 1,10 ----
 """Spit out the Python reserved words table."""
 
! import keyword
 
 ncols = 5
 
 def main():
! words = keyword.kwlist[:]
 words.sort()
 colwidth = 1 + max(map(len, words))

AltStyle によって変換されたページ (->オリジナル) /