Reputation: 5367
I have found some code which is apparently designed for python 3.6.
For some reason I need to run that code in a python 3.5 environment. Supposedly, the two versions should be backward compatible. However, the original code abuses in f-strings, raising hundreds of errors in py35
do you know any tool to remove those fstrings, or a clean workaround?
Upvotes: 3
Views: 1396
Reputation: 1274
You can't create a backward-compatible Python 3.6 piece of software if you're using f-String formatting. The reason for this is that it's a fundamental syntax feature, so "making" it compatible with Python 3.5, for example, would imply changing the Python 3.5 interpreter itself.
The only "clean workaround" I can think of is formatting the strings in a way that does not conflict the previous Python versions you want your software compatible with.
Hope this helps.
Upvotes: 2