mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
GH-96179: Fix misleading example on the bisect documentation (GH-96228)
The `movies[bisect(movies, 1960, key=by_year)]` will actually return only movies **after** 1960.
This commit is contained in:
parent
09563a764e
commit
4317b25a23
2 changed files with 2 additions and 1 deletions
|
@ -216,7 +216,7 @@ records in a table::
|
||||||
... Movie('Aliens', 1986, 'Scott')
|
... Movie('Aliens', 1986, 'Scott')
|
||||||
... ]
|
... ]
|
||||||
|
|
||||||
>>> # Find the first movie released on or after 1960
|
>>> # Find the first movie released after 1960
|
||||||
>>> by_year = attrgetter('released')
|
>>> by_year = attrgetter('released')
|
||||||
>>> movies.sort(key=by_year)
|
>>> movies.sort(key=by_year)
|
||||||
>>> movies[bisect(movies, 1960, key=by_year)]
|
>>> movies[bisect(movies, 1960, key=by_year)]
|
||||||
|
|
|
@ -1419,6 +1419,7 @@ John Popplewell
|
||||||
Matheus Vieira Portela
|
Matheus Vieira Portela
|
||||||
Davin Potts
|
Davin Potts
|
||||||
Guillaume Pratte
|
Guillaume Pratte
|
||||||
|
Pedro Pregueiro
|
||||||
Florian Preinstorfer
|
Florian Preinstorfer
|
||||||
Alex Prengère
|
Alex Prengère
|
||||||
Amrit Prem
|
Amrit Prem
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue