Python Forum

Full Version: f-strings in a script to be made public
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
just about all my python scripts now use f-strings. many of those use many f-strings. as literals to be parsed during the compile phase, in python interpreters before version 3.6, they are syntax errors. this means users get told about this in a traceback. is there some means i can add to this information to be more informative to users that might not be coders so they understand what to do to fix it?
IMHO, I think the best approach is to specify in the description/docstring the script requires 3.6+ and versions before that are not supported.
i already do that, both in the docstring, and in comments. i just wanted to go a step further and handle the situation of the user trying to run the script.