Staging
v0.5.1
swh:1:snp:635f4099902912592851108bcac178ff574f7c5f
Raw File
Tip revision: 648aa1db46291bd40c37c08329c18676031f301a authored by cvs2svn on 08 February 2005, 13:27:52 UTC
This commit was manufactured by cvs2svn to create tag 'r235'.
Tip revision: 648aa1d
reswords.py
"""Spit out the Python reserved words table."""

import keyword

ncols = 5

def main():
    words = keyword.kwlist[:]
    words.sort()
    colwidth = 1 + max(map(len, words))
    nwords = len(words)
    nrows = (nwords + ncols - 1) / ncols
    for irow in range(nrows):
	for icol in range(ncols):
	    i = irow + icol * nrows
	    if 0 <= i < nwords:
		word = words[i]
	    else:
		word = ""
	    print "%-*s" % (colwidth, word),
	print

main()
back to top