In c++ there is a function stable_sort() function (It preserves the order ) .Is there any function in python like this ?
            Asked
            
        
        
            Active
            
        
            Viewed 51 times
        
    -1
            
            
        - 
                    1See this: https://stackoverflow.com/questions/1915376/is-pythons-sorted-function-guaranteed-to-be-stable. `sorted` function is guaranteed to be stable. – NotAName Oct 21 '22 at 04:06
1 Answers
2
            list.sort() is stable. From the documentation:
The sort() method 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 (for example, sort by department, then by salary grade).
 
    
    
        Mark Tolonen
        
- 166,664
- 26
- 169
- 251
