I am using 2to3 to convert a script. The only warning I get is:
RefactoringTool: Line 716: You should use 'operator.mul(None)' here.
Line 716 of the original script is:
classes = repeat(None)
I don't get where shall I use operator.mul(None)
. The reference documentation of repeat()
(link to docs) shows that I can pass None
without any problem. So, what shall I do?
2to3 is just getting confused about which repeat
you mean. It thinks you're using operator.repeat
in Python 2:
Help on built-in function repeat in module operator:
repeat(...)
repeat(a, b) -- Return a * b, where a is a sequence, and b is an integer.
instead of itertools.repeat
. That's not a great guess on its part, to be honest, because operator.repeat
takes 2 arguments, but that's what it's guessing. You can see the transformation listed in the docs.
You can avoid the warning by using the fully-qualified itertools.repeat
or just ignore it.