Ka-Ping Yee's version is better:
Here's a "keyword" module which, in the spirit of "token.py", updates the list of keywords automatically from a source file (in this case, "graminit.c" seemed like a reasonable choice, easier than "Grammar/Grammar"). You get "kwlist", a sorted list of keywords; "kwdict", a dictionary mapping each keyword to 1; and "iskeyword", a function which tells you if a given string happens to be a keyword.
G
Guido van Rossum committed
eb8c972648c9fec8bad5419eb1ab13cafa52d3d8
Parent: 90d556f