1997-05-08 20:21:48 -03:00
|
|
|
"""Spit out the Python reserved words table."""
|
|
|
|
|
2001-12-04 16:39:36 -04:00
|
|
|
import keyword
|
1997-05-08 20:21:48 -03:00
|
|
|
|
|
|
|
ncols = 5
|
|
|
|
|
|
|
|
def main():
|
2001-12-04 16:39:36 -04:00
|
|
|
words = keyword.kwlist[:]
|
1997-05-08 20:21:48 -03:00
|
|
|
words.sort()
|
|
|
|
colwidth = 1 + max(map(len, words))
|
|
|
|
nwords = len(words)
|
2006-09-06 03:51:57 -03:00
|
|
|
nrows = (nwords + ncols - 1) // ncols
|
1997-05-08 20:21:48 -03:00
|
|
|
for irow in range(nrows):
|
2004-07-18 03:25:50 -03:00
|
|
|
for icol in range(ncols):
|
|
|
|
i = irow + icol * nrows
|
|
|
|
if 0 <= i < nwords:
|
|
|
|
word = words[i]
|
|
|
|
else:
|
|
|
|
word = ""
|
|
|
|
print "%-*s" % (colwidth, word),
|
|
|
|
print
|
1997-05-08 20:21:48 -03:00
|
|
|
|
|
|
|
main()
|