[Python-checkins] CVS: python/dist/src/Mac/scripts gensuitemodule.py,1.20,1.21
Jack Jansen
jackjansen@users.sourceforge.net
2002年1月24日 14:44:09 -0800
Update of /cvsroot/python/python/dist/src/Mac/scripts
In directory usw-pr-cvs1:/tmp/cvs-serv22436/Python/Mac/scripts
Modified Files:
gensuitemodule.py
Log Message:
Get rid of keyword list and use keyword.iskeyword() function (which I wasn't aware of previously).
Index: gensuitemodule.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** gensuitemodule.py 2002年01月24日 12:36:51 1.20
--- gensuitemodule.py 2002年01月24日 22:44:07 1.21
***************
*** 14,17 ****
--- 14,18 ----
import StringIO
import macfs
+ import keyword
from Carbon.Res import *
***************
*** 817,826 ****
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:
--- 818,821 ----
***************
*** 842,846 ****
rv = rv + '_%02.2x_'%ord(c)
ok = ok2
! if rv in illegal_ids:
rv = '_' + rv
return rv
--- 837,841 ----
rv = rv + '_%02.2x_'%ord(c)
ok = ok2
! if keyword.iskeyword(rv):
rv = '_' + rv
return rv
***************
*** 851,852 ****
--- 846,848 ----
main()
sys.exit(1)
+ print identify('for')
\ No newline at end of file