Kaydet (Commit) dd42edcc authored tarafından Guido van Rossum's avatar Guido van Rossum

Rename variables _seq to _it and seq to it, to emphasize that this is

an iterator (which can only be used once!).
üst 6fa2dc70
...@@ -75,10 +75,10 @@ else: ...@@ -75,10 +75,10 @@ else:
# in Timer.__init__() depend on setup being indented 4 spaces and stmt # in Timer.__init__() depend on setup being indented 4 spaces and stmt
# being indented 8 spaces. # being indented 8 spaces.
template = """ template = """
def inner(_seq, _timer): def inner(_it, _timer):
%(setup)s %(setup)s
_t0 = _timer() _t0 = _timer()
for _i in _seq: for _i in _it:
%(stmt)s %(stmt)s
_t1 = _timer() _t1 = _timer()
return _t1 - _t0 return _t1 - _t0
...@@ -151,10 +151,10 @@ class Timer: ...@@ -151,10 +151,10 @@ class Timer:
the timer function to be used are passed to the constructor. the timer function to be used are passed to the constructor.
""" """
if itertools: if itertools:
seq = itertools.repeat(None, number) it = itertools.repeat(None, number)
else: else:
seq = [None] * number it = [None] * number
return self.inner(seq, self.timer) return self.inner(it, self.timer)
def repeat(self, repeat=default_repeat, number=default_number): def repeat(self, repeat=default_repeat, number=default_number):
"""Call timer() a few times. """Call timer() a few times.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment