TurqW / LongSphinx

Discord bot made to help with role management and RPG playing. Name inspired by the Terra Ignota series by Ada Palmer.
5 stars 3 forks source link

Convert old formatting syntax to f-string format? #73

Closed Magikarple closed 4 years ago

Magikarple commented 4 years ago

f-strings are more readable, they can also be slightly shorter and are slightly faster

for example, this line in colors.py

"#%06x" % random.randint(0, 0xFFFFFF)

can be replaced with...

f"#{random.randint(0, 0xFFFFFF):x}"

https://cito.github.io/blog/f-strings/ for more info

TurqW commented 4 years ago

interesting and good to know; will probably happen a bit at a time as I touch other things.