Open benbariteau opened 5 years ago
To be clear this is when from __future__ import print_function
is not present initially.
this is a bug in lib2to3
fwiw:
$ python3.8 -m lib2to3 -f print t.py
RefactoringTool: Refactored t.py
--- t.py (original)
+++ t.py (refactored)
@@ -1 +1 @@
-print("foo{}".format(1))
+print(("foo{}".format(1)))
RefactoringTool: Files that need to be modified:
RefactoringTool: t.py
since it's fairly common to end up in this state, I'm adding a fixer for this in pyupgrade: https://github.com/asottile/pyupgrade/pull/122
Nice project :-). We've kind of split 2to3 into two tools - modernize when you want to add Python 3 support, and pyupgrade
with the --py3-plus
flag (from looking at your README) when you want to drop Python 2 support.
given
the
print
fixer will change it to:While not incorrect, it's definitely a little odd.