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.
This commit is contained in:
Guido van Rossum 2006-08-18 22:13:04 +00:00
parent d2dbecb4ae
commit e2b70bcf74
93 changed files with 215 additions and 313 deletions

View file

@ -517,23 +517,14 @@ def read_decimalnl_long(f):
r"""
>>> import StringIO
>>> read_decimalnl_long(StringIO.StringIO("1234\n56"))
Traceback (most recent call last):
...
ValueError: trailing 'L' required in '1234'
Someday the trailing 'L' will probably go away from this output.
>>> read_decimalnl_long(StringIO.StringIO("1234L\n56"))
1234L
1234
>>> read_decimalnl_long(StringIO.StringIO("123456789012345678901234L\n6"))
123456789012345678901234L
123456789012345678901234
"""
s = read_stringnl(f, decode=False, stripquotes=False)
if not s.endswith("L"):
raise ValueError("trailing 'L' required in %r" % s)
return long(s)
@ -625,15 +616,15 @@ def read_long1(f):
r"""
>>> import StringIO
>>> read_long1(StringIO.StringIO("\x00"))
0L
0
>>> read_long1(StringIO.StringIO("\x02\xff\x00"))
255L
255
>>> read_long1(StringIO.StringIO("\x02\xff\x7f"))
32767L
32767
>>> read_long1(StringIO.StringIO("\x02\x00\xff"))
-256L
-256
>>> read_long1(StringIO.StringIO("\x02\x00\x80"))
-32768L
-32768
"""
n = read_uint1(f)
@ -657,15 +648,15 @@ def read_long4(f):
r"""
>>> import StringIO
>>> read_long4(StringIO.StringIO("\x02\x00\x00\x00\xff\x00"))
255L
255
>>> read_long4(StringIO.StringIO("\x02\x00\x00\x00\xff\x7f"))
32767L
32767
>>> read_long4(StringIO.StringIO("\x02\x00\x00\x00\x00\xff"))
-256L
-256
>>> read_long4(StringIO.StringIO("\x02\x00\x00\x00\x00\x80"))
-32768L
-32768
>>> read_long1(StringIO.StringIO("\x00\x00\x00\x00"))
0L
0
"""
n = read_int4(f)