summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-12-02 07:48:15 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-12-02 07:48:15 (GMT)
commit70ef8692a193a70dfd49610f725cb23c14b32fe3 (patch)
tree37e7540998c44cdfb33315a0e720c635525fc6f1
parent25695282a57e3212acb48ab4d022bf2ea4092e1d (diff)
downloadcpython-70ef8692a193a70dfd49610f725cb23c14b32fe3.zip
cpython-70ef8692a193a70dfd49610f725cb23c14b32fe3.tar.gz
cpython-70ef8692a193a70dfd49610f725cb23c14b32fe3.tar.bz2
SF patch #852140: keyword.py - use __contains__ and bool
Use a set instead of dict with values equal to one.
-rwxr-xr-xLib/keyword.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/Lib/keyword.py b/Lib/keyword.py
index c897081..a0295e2 100755
--- a/Lib/keyword.py
+++ b/Lib/keyword.py
@@ -46,11 +46,7 @@ kwlist = [
#--end keywords--
]
-kwdict = {}
-for keyword in kwlist:
- kwdict[keyword] = 1
-
-iskeyword = kwdict.has_key
+iskeyword = frozenset(kwlist).__contains__
def main():
import sys, re