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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4