0

What does the forward slash and asterisk represent on the docstring?

sorted(iterable, /, *, key=None, reverse=False)

Return a new sorted list from the items in iterable.

Has two optional arguments which must be specified as keyword arguments.

key specifies a function of one argument that is used to extract a comparison key from each element in iterable (for example, key=str.lower). The default value is None (compare the elements directly).

reverse is a boolean value. If set to True, then the list elements are sorted as if each comparison were reversed.

Just curious about what these represent as they don't get explanation in the documentation.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
aaron
  • 1
  • 2

0 Answers0