python的sorted()函数、列表的sort()方法,都是稳定的。即排序不改变相同元素的前后关系。
The built-in sorted() function is guaranteed to be stable. A sort is stable if it guarantees not to change the relative order of elements that compare equal — this is helpful for sorting in multiple passes