blob: 29f326fe2ca805c2bd0b857a874707d0f7e7a928 [file] [log] [blame]
Guido van Rossum4408ed51997-05-08 23:21:48 +00001"""Spit out the Python reserved words table."""
2
Guido van Rossum4ed6be72001-12-04 20:39:36 +00003import keyword
Guido van Rossum4408ed51997-05-08 23:21:48 +00004
5ncols = 5
6
7def main():
Guido van Rossum4ed6be72001-12-04 20:39:36 +00008 words = keyword.kwlist[:]
Guido van Rossum4408ed51997-05-08 23:21:48 +00009 words.sort()
10 colwidth = 1 + max(map(len, words))
11 nwords = len(words)
12 nrows = (nwords + ncols - 1) / ncols
13 for irow in range(nrows):
14 for icol in range(ncols):
15 i = irow + icol * nrows
16 if 0 <= i < nwords:
17 word = words[i]
18 else:
19 word = ""
20 print "%-*s" % (colwidth, word),
21 print
22
23main()