Commit 5497adb7 authored by Meador Inge's avatar Meador Inge Committed by Dylan Trotter

Make `list.sort` stable (#103)

Python gaurantees that its builtin sort for mutable sequences is stable.
For more details, see note (9) in:

  * https://docs.python.org/2/library/stdtypes.html#mutable-sequence-types

I couldn't come up with a decent way to test this.
parent b0cf3a15
......@@ -114,7 +114,9 @@ func (l *List) Sort(f *Frame) (raised *BaseException) {
}
raised = sorter.raised
}()
sort.Sort(sorter)
// Python guarantees stability. See note (9) in:
// https://docs.python.org/2/library/stdtypes.html#mutable-sequence-types
sort.Stable(sorter)
return nil
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment