mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Fix most trivially-findable print statements.
There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.)
This commit is contained in:
parent
452bf519a7
commit
be19ed77dd
331 changed files with 2567 additions and 2648 deletions
|
@ -38,7 +38,7 @@ def randfloats(n):
|
|||
except os.error:
|
||||
pass
|
||||
except IOError as msg:
|
||||
print "can't write", fn, ":", msg
|
||||
print("can't write", fn, ":", msg)
|
||||
else:
|
||||
result = marshal.load(fp)
|
||||
fp.close()
|
||||
|
@ -60,7 +60,7 @@ def doit(L):
|
|||
t0 = time.clock()
|
||||
L.sort()
|
||||
t1 = time.clock()
|
||||
print "%6.2f" % (t1-t0),
|
||||
print("%6.2f" % (t1-t0), end=' ')
|
||||
flush()
|
||||
|
||||
def tabulate(r):
|
||||
|
@ -84,11 +84,11 @@ def tabulate(r):
|
|||
"""
|
||||
cases = tuple([ch + "sort" for ch in r"*\/3+%~=!"])
|
||||
fmt = ("%2s %7s" + " %6s"*len(cases))
|
||||
print fmt % (("i", "2**i") + cases)
|
||||
print(fmt % (("i", "2**i") + cases))
|
||||
for i in r:
|
||||
n = 1 << i
|
||||
L = randfloats(n)
|
||||
print "%2d %7d" % (i, n),
|
||||
print("%2d %7d" % (i, n), end=' ')
|
||||
flush()
|
||||
doit(L) # *sort
|
||||
L.reverse()
|
||||
|
@ -137,7 +137,7 @@ def tabulate(r):
|
|||
# significantly faster if we leave tham as ints.
|
||||
L = map(float, L)
|
||||
doit(L) # !sort
|
||||
print
|
||||
print()
|
||||
|
||||
def main():
|
||||
"""Main program when invoked as a script.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue