CharlotteJackson / DC_Crash_Bot

10 stars 7 forks source link

updating to use more readable f strings vs .format #92

Closed unhott closed 3 years ago

unhott commented 3 years ago

I was reviewing this and trying to make sense of it, so I translated instances of .format() to f strings.

If you are in python 3.6 (iirc) or greater, then f strings are typically more readable and easier to write.

If there's a reason that this needs to be compatible with python < 3.6, feel free to close this :)

unhott commented 3 years ago

There were a few instances of something like dictionary[very_long_key1][very_long_key2] that could potentially be made more readable by adding a shorter, more readable variable. e.g.,

readable_name = dictionary[very_long_key1][very_long_key2]
string = f'{readable_name} is more readable than {dictionary[very_long_key1][very_long_key2]}' 

but I wasn't really thinking too deeply to make such a change

banjtheman commented 3 years ago

yea f strings better, don't think using python 2.7? but hate to make changes to lots of files at once esp if conflicts and just simple formating changes. Will hold off on this for now