What arguments does Python sort() function have?

前端 未结 3 1874
深忆病人
深忆病人 2020-12-03 01:47

Is there any other argument than key, for example: value?

3条回答
  •  情书的邮戳
    2020-12-03 02:36

    Yes, it takes other arguments, but no value.

    >>> print list.sort.__doc__
    L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;
    cmp(x, y) -> -1, 0, 1
    

    What would a value argument even mean?

提交回复
热议问题