For some projects, I'd like to stop supporting Python 2.7 (see http://python3statement.org/) to use only Python > 3.6 (or rather 3.5 + f-string, like Pypy v6.0).
A first step could be to modify the setup.py file to get an explicit error if one try to use the package with a Python version without f-string.
But then there is a lot of work to switch to pure Python 3.6 syntax and remove all the
and to replace in many places
class MyClass(object)
->class MyClass:
super(MyClass, self)
->super()
"{}".format(foo)
->f"{foo}"
I did this work for a code basically manually (actually I also automate some steps by processing the code with a Python script) and I really see the difference. The code is much less verbose now and globally much nicer.
I'm sure that I forget many other nice simplifications that could be done, for example I now use a lot from pathlib import Path
but these changes are much less direct.
How would you transform a Python 2.7/3.6 compatible code to a clean Python 3.6 code? How can you avoid to do this boring work manually?
Edit after the first answer
I think a hypothetical internalization (which in many cases won't append) should not stop us from using f-strings, which are just cleaner (and slightly faster).
I still think the modifications that I mentioned are reasonable.