mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +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
|
@ -210,8 +210,8 @@ def main(args=None):
|
|||
["number=", "setup=", "repeat=",
|
||||
"time", "clock", "verbose", "help"])
|
||||
except getopt.error as err:
|
||||
print err
|
||||
print "use -h/--help for command line help"
|
||||
print(err)
|
||||
print("use -h/--help for command line help")
|
||||
return 2
|
||||
timer = default_timer
|
||||
stmt = "\n".join(args) or "pass"
|
||||
|
@ -238,7 +238,7 @@ def main(args=None):
|
|||
precision += 1
|
||||
verbose += 1
|
||||
if o in ("-h", "--help"):
|
||||
print __doc__,
|
||||
print(__doc__, end=' ')
|
||||
return 0
|
||||
setup = "\n".join(setup) or "pass"
|
||||
# Include the current directory, so that local imports work (sys.path
|
||||
|
@ -257,7 +257,7 @@ def main(args=None):
|
|||
t.print_exc()
|
||||
return 1
|
||||
if verbose:
|
||||
print "%d loops -> %.*g secs" % (number, precision, x)
|
||||
print("%d loops -> %.*g secs" % (number, precision, x))
|
||||
if x >= 0.2:
|
||||
break
|
||||
try:
|
||||
|
@ -267,18 +267,18 @@ def main(args=None):
|
|||
return 1
|
||||
best = min(r)
|
||||
if verbose:
|
||||
print "raw times:", " ".join(["%.*g" % (precision, x) for x in r])
|
||||
print "%d loops," % number,
|
||||
print("raw times:", " ".join(["%.*g" % (precision, x) for x in r]))
|
||||
print("%d loops," % number, end=' ')
|
||||
usec = best * 1e6 / number
|
||||
if usec < 1000:
|
||||
print "best of %d: %.*g usec per loop" % (repeat, precision, usec)
|
||||
print("best of %d: %.*g usec per loop" % (repeat, precision, usec))
|
||||
else:
|
||||
msec = usec / 1000
|
||||
if msec < 1000:
|
||||
print "best of %d: %.*g msec per loop" % (repeat, precision, msec)
|
||||
print("best of %d: %.*g msec per loop" % (repeat, precision, msec))
|
||||
else:
|
||||
sec = msec / 1000
|
||||
print "best of %d: %.*g sec per loop" % (repeat, precision, sec)
|
||||
print("best of %d: %.*g sec per loop" % (repeat, precision, sec))
|
||||
return None
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue