py-cvs-rel2_1 (Rev 1.2) merge
[python/dscho.git] / Doc / ref / reswords.py
blob22c3bb850e5fad3ca7735ae79d2b1ea45e894b07
1 """Spit out the Python reserved words table."""
3 import string
5 raw_words = """
6 and del for is raise
7 assert elif from lambda return
8 break else global not try
9 class except if or while
10 continue exec import pass
11 def finally in print
12 """
14 ncols = 5
16 def main():
17 words = string.split(raw_words)
18 words.sort()
19 colwidth = 1 + max(map(len, words))
20 nwords = len(words)
21 nrows = (nwords + ncols - 1) / ncols
22 for irow in range(nrows):
23 for icol in range(ncols):
24 i = irow + icol * nrows
25 if 0 <= i < nwords:
26 word = words[i]
27 else:
28 word = ""
29 print "%-*s" % (colwidth, word),
30 print
32 main()