As always, first have a look at the documentation for list.sort
:
sort(*, key=None, reverse=None)
This method sorts the list in place, using only <
comparisons between items.
reverse is a boolean value. If set to True, then the list elements are sorted as if each comparison were reversed.
So the items in your list will be sorted from "smallest" to "largest" using the <
comparion, which for strings means lexicographical ordering (A < AB < B). To sort it in reverse order, use the reverse
parameter:
short_names.sort(reverse=True)
For more information have a look at the official Sorting HOW TO.