Skip to content

Commit 069511b

Browse files
committed
corrected refrence to python internal sort method from timsort to powersort. (exercism#3776)
1 parent 6e7c281 commit 069511b

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

concepts/list-methods/about.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,22 @@ The order of list elements can be reversed _**in place**_ with `<list>.reverse(
136136
[3, 2, 1]
137137
```
138138

139-
List elements can be sorted _**in place**_ using `<list>.sort()`.
140-
Internally, Python uses [`Timsort`][timsort] to arrange the elements.
141-
The default order is _ascending_.
142-
The Python docs have [additional tips and techniques for sorting][sorting how to] `lists` effectively.
139+
A list can be re-ordered _**in place**_ with the help of `<list>.sort()`.
140+
Default sort order is _ascending_ from the left.
141+
The Python docs offer [additional tips and techniques for sorting][sorting how to] lists effectively.
142+
143+
144+
~~~~exercism/note
145+
From 2002 to 2022, Python used an algorithm called [`Timsort`][timsort] internally to arrange lists, but switched to [`Powersort`][powersort] from `Python 3.11` onward.
146+
You can read more details and discussion on the change from the core Python team in the GitHub [issue 78742][78742].
147+
148+
For technical details on the algorithm, see the J. Ian Munro and Sebastian Wild paper [Nearly-Optimal Mergesorts: Fast, Practical Sorting Methods That Optimally Adapt to Existing Runs][nearly-optimal-mergesorts]
149+
150+
[78742]: https://github.com/python/cpython/issues/78742
151+
[nearly-optimal-mergesorts]: https://arxiv.org/abs/1805.04154
152+
[powersort]: https://www.wild-inter.net/publications/munro-wild-2018
153+
[timsort]: https://en.wikipedia.org/wiki/Timsort
154+
~~~~
143155

144156

145157
```python
@@ -256,5 +268,6 @@ For a detailed explanation of names, values, list, and nested list behavior, tak
256268
[slice notation]: https://docs.python.org/3/reference/expressions.html#slicings
257269
[sorted]: https://docs.python.org/3/library/functions.html#sorted
258270
[sorting how to]: https://docs.python.org/3/howto/sorting.html
259-
[timsort]: https://en.wikipedia.org/wiki/Timsort
260271
[tuple]: https://docs.python.org/3/library/stdtypes.html#tuple
272+
273+

exercises/concept/chaitanas-colossal-coaster/.docs/introduction.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,15 @@ The `<list>.reverse()` method will reverse the order of elements **in-place**.
151151

152152

153153
A list can be re-ordered _**in place**_ with the help of `<list>.sort()`.
154-
Internally, Python uses [`Timsort`][timsort] to arrange the list.
155-
Default order is _ascending_ from the left.
156-
The Python docs offer [additional tips and techniques for sorting][sorting how to] lists effectively.
154+
Default sort order is _ascending_ from the left.
155+
The Python docs offer [additional tips and techniques for sorting][sorting how to] lists effectively.
156+
157+
~~~~exercism/note
158+
From 2002 to 2022, Python used an algorithm called [`Timsort`][timsort] internally to arrange lists, but switched to [`Powersort`][powersort] from `Python 3.11` onward.
159+
160+
[powersort]: https://www.wild-inter.net/publications/munro-wild-2018
161+
[timsort]: https://en.wikipedia.org/wiki/Timsort
162+
~~~~
157163

158164

159165
```python
@@ -244,5 +250,4 @@ ValueError: 10 is not in list
244250
[slice notation]: https://docs.python.org/3/reference/expressions.html#slicings
245251
[sorted]: https://docs.python.org/3/library/functions.html#sorted
246252
[sorting how to]: https://docs.python.org/3/howto/sorting.html
247-
[timsort]: https://en.wikipedia.org/wiki/Timsort
248253
[tuple]: https://docs.python.org/3/library/stdtypes.html#tuple

0 commit comments

Comments
 (0)