Skip to content

Commit 8b0ee24

Browse files
committed
(Much) better list of Python keywords, supplied by Michael J. Barber.
1 parent c8febec commit 8b0ee24

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Mac/scripts/gensuitemodule.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,11 @@ def compiledataflags(flags):
816816
bits.append(`i`)
817817
return '[%s]' % string.join(bits)
818818

819-
# XXXX Do we have a set of python keywords somewhere?
820-
illegal_ids = [ "for", "in", "from", "and", "or", "not", "print", "class", "return",
821-
"def" ]
819+
# Set of Python keywords (as of Python 2.2)
820+
illegal_ids = ["and", "elif", "global", "or", "assert", "else", "if", "pass",
821+
"break", "except", "import", "print", "class", "exec", "in", "raise",
822+
"continue", "finally", "is", "return", "def", "for", "lambda", "try",
823+
"del", "from", "not", "while"]
822824

823825
def identify(str):
824826
"""Turn any string into an identifier:

0 commit comments

Comments
 (0)