Dinnerbone / mcstatus

A Python class for checking the status of an enabled Minecraft server
http://dinnerbone.com/minecraft/tools/status/
1.11k stars 146 forks source link

Use f-strings instead of % formatting or str.format #167

Closed ItsDrike closed 2 years ago

ItsDrike commented 2 years ago

Since python 3.6, support for "f-strings" was added, this allows us to format strings in a very simple way:

variable = "some value"
foo = f"This string contains {variable}"

This is much more readable than using str.format or the % formatting notation.

I assume the reason these older ways to format strings was to keep the library compatible with older python versions, however at the moment, this library supports >=3.6 which allows us to utilize these f-strings instead of the less readable methods.