Feb-10-2020, 09:37 AM
This example snippet you've posted is an Anti-pattern.
The sense behind f-strings are to make it easier readable and not to save lines of code.
The sense behind f-strings are to make it easier readable and not to save lines of code.
def my_keyfunc(char): """ Return the index of the string "of" """ return "of".index(char) sorted_str = "".join(sorted("foo", key=my_keyfunc)) print(f'This is the sorted_str: {sorted_str}')
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!