summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-01-24 22:44:07 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-01-24 22:44:07 (GMT)
commitb2ecc2c6c8554185c2f6aae985a41921f1f21d1e (patch)
tree24017dc8641e9935f549acf984ce69ecd5368480 /Mac
parent744f67fb62a1eb98ec17eecfa89f98361b35bd11 (diff)
downloadcpython-b2ecc2c6c8554185c2f6aae985a41921f1f21d1e.zip
cpython-b2ecc2c6c8554185c2f6aae985a41921f1f21d1e.tar.gz
cpython-b2ecc2c6c8554185c2f6aae985a41921f1f21d1e.tar.bz2
Get rid of keyword list and use keyword.iskeyword() function (which I wasn't aware of previously).
Diffstat (limited to 'Mac')
-rw-r--r--Mac/scripts/gensuitemodule.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/Mac/scripts/gensuitemodule.py b/Mac/scripts/gensuitemodule.py
index 04cd7c9..5a4c806 100644
--- a/Mac/scripts/gensuitemodule.py
+++ b/Mac/scripts/gensuitemodule.py
@@ -13,6 +13,7 @@ import sys
import types
import StringIO
import macfs
+import keyword
from Carbon.Res import *
@@ -816,12 +817,6 @@ def compiledataflags(flags):
bits.append(`i`)
return '[%s]' % string.join(bits)
-# Set of Python keywords (as of Python 2.2)
-illegal_ids = ["and", "elif", "global", "or", "assert", "else", "if", "pass",
- "break", "except", "import", "print", "class", "exec", "in", "raise",
- "continue", "finally", "is", "return", "def", "for", "lambda", "try",
- "del", "from", "not", "while", "yield"]
-
def identify(str):
"""Turn any string into an identifier:
- replace space by _
@@ -841,7 +836,7 @@ def identify(str):
else:
rv = rv + '_%02.2x_'%ord(c)
ok = ok2
- if rv in illegal_ids:
+ if keyword.iskeyword(rv):
rv = '_' + rv
return rv
@@ -850,3 +845,4 @@ def identify(str):
if __name__ == '__main__':
main()
sys.exit(1)
+print identify('for') \ No newline at end of file