Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 70ef869

Browse files
committed
SF patch #852140: keyword.py - use __contains__ and bool
Use a set instead of dict with values equal to one.
1 parent 2569528 commit 70ef869

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

Lib/keyword.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@
4646
#--end keywords--
4747
]
4848

49-
kwdict = {}
50-
for keyword in kwlist:
51-
kwdict[keyword] = 1
52-
53-
iskeyword = kwdict.has_key
49+
iskeyword = frozenset(kwlist).__contains__
5450

5551
def main():
5652
import sys, re

0 commit comments

Comments
 (0)