byexamples / byexample

Write snippets of code in C++, Python, Ruby, and others as documentation and execute them as regression tests.
https://byexamples.github.io/byexample/
GNU General Public License v3.0
55 stars 8 forks source link

Refactor code and use the Python 3.6's f-strings for the messages in byexample #153

Open eldipa opened 3 years ago

eldipa commented 3 years ago

Describe the feature you'd like Now the byexample dropped support for Python 3.5 we can improve the code using the f-strings that appeared in Python 3.6

For example:

var1 = 12
msg1 = "Message using old C-like style: %s" % var1
msg2 = "Message using old format-like style: {}". format(var1)

Things like that could be written as

msg3 = f"Message using the new f-string style {var1}"

Additional context (optional) A lot of things will be modified, we need to have small commits and run the tests on each step to make sure that we are not making any mistake.

eldipa commented 2 years ago

Take a look to flynt, a tool that automates this.