Python Forum
f-strings in a script to be made public - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: f-strings in a script to be made public (/thread-23497.html)



f-strings in a script to be made public - Skaperen - Jan-03-2020

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?


RE: f-strings in a script to be made public - buran - Jan-03-2020

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.


RE: f-strings in a script to be made public - Skaperen - Jan-03-2020

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.