diff options
author | Guido van Rossum <guido@python.org> | 2006-08-18 22:13:04 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-08-18 22:13:04 (GMT) |
commit | e2b70bcf7401477936fba99a8bf4a1f759ecc8a3 (patch) | |
tree | 4c9b65b7fd8c26a3d2f1b64ecd6b4c72a756b4b2 /Lib/difflib.py | |
parent | d2dbecb4ae9177e2e87adcb047147c6bcbf28cc1 (diff) | |
download | cpython-e2b70bcf7401477936fba99a8bf4a1f759ecc8a3.zip cpython-e2b70bcf7401477936fba99a8bf4a1f759ecc8a3.tar.gz cpython-e2b70bcf7401477936fba99a8bf4a1f759ecc8a3.tar.bz2 |
Get rid of dict.has_key(). Boy this has a lot of repercussions!
Not all code has been fixed yet; this is just a checkpoint...
The C API still has PyDict_HasKey() and _HasKeyString(); not sure
if I want to change those just yet.
Diffstat (limited to 'Lib/difflib.py')
-rw-r--r-- | Lib/difflib.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/difflib.py b/Lib/difflib.py index 3e28b18..7ab682d 100644 --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -199,7 +199,7 @@ class SequenceMatcher: # DON'T USE! Only __chain_b uses this. Use isbjunk. # isbjunk # for x in b, isbjunk(x) == isjunk(x) but much faster; - # it's really the has_key method of a hidden dict. + # it's really the __contains__ method of a hidden dict. # DOES NOT WORK for x in a! # isbpopular # for x in b, isbpopular(x) is true iff b is reasonably long @@ -341,8 +341,8 @@ class SequenceMatcher: # lot of junk in the sequence, the number of *unique* junk # elements is probably small. So the memory burden of keeping # this dict alive is likely trivial compared to the size of b2j. - self.isbjunk = junkdict.has_key - self.isbpopular = populardict.has_key + self.isbjunk = junkdict.__contains__ + self.isbpopular = populardict.__contains__ def find_longest_match(self, alo, ahi, blo, bhi): """Find longest matching block in a[alo:ahi] and b[blo:bhi]. @@ -674,7 +674,7 @@ class SequenceMatcher: # avail[x] is the number of times x appears in 'b' less the # number of times we've seen it in 'a' so far ... kinda avail = {} - availhas, matches = avail.has_key, 0 + availhas, matches = avail.__contains__, 0 for elt in self.a: if availhas(elt): numb = avail[elt] |