From: Raymond Hettinger Date: Tue, 2 Dec 2003 07:48:15 +0000 (+0000) Subject: SF patch #852140: keyword.py - use __contains__ and bool X-Git-Tag: v2.4a1~1177 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=70ef8692a193a70dfd49610f725cb23c14b32fe3;p=thirdparty%2FPython%2Fcpython.git SF patch #852140: keyword.py - use __contains__ and bool Use a set instead of dict with values equal to one. --- diff --git a/Lib/keyword.py b/Lib/keyword.py index c89708157f28..a0295e2139e9 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