Debugging (was Re: Why not allow empty code blocks?)
Terry Reedy
tjreedy at udel.edu
Thu Aug 4 14:37:47 EDT 2016
Making repeat a keyword would have such an extremely high cost
that it is out of the question and not a sane proposal.
To start with, it is used in two major, widely used APIs.
itertools.repeat + 50 uses in other itertools and tests
+ all the imports and and uses of repeat()
in code all over the world.
timeit command line option
timeit.timeit(..., repeat=3) parameter name
timeit.repeat() function + tests
+ all the scripts (some in other languages) using 'repeat'
as a command line option and all the python code using
the parameter or function.
There are other C-coded public APIs that use repeat. One in xml.etree
was revealed by the grep hit for the Python-coded test.
Other places in the *Python-coded* stdlib that would break.
distutils\fancy_getopt.py: 141: self.repeat = {}
lib2to3\fixes\fix_operator.py: 8: operator.repeat(obj, n) ...
lib2to3\patcomp.py: 105: repeat = None
lib2to3\patcomp.py: 139: def compile_basic(self, nodes, repeat=None):
lib2to3\tests\test_fixers.py: 4494: b = "operator.repeat(x, n)"
test\test_faulthandler.py: 533: repeat = {repeat}
test\test_faulthandler.py: 539: def func(timeout, repeat, ...
test\test_xml_etree.py: 1784: for dumper, loader in
product(self.modules, repeat=2):
typing.py: 373: def repeat(x: T, n: int) -> Sequence[T]:
--
Terry Jan Reedy
More information about the Python-list
mailing list