mirror of
https://github.com/python/cpython.git
synced 2026-02-05 17:35:34 +00:00
Programming FAQ: fix some punctuaction typos (GH-144058)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
This commit is contained in:
parent
052e55e7d4
commit
03e651d601
1 changed files with 3 additions and 3 deletions
|
|
@ -1226,13 +1226,13 @@ This converts the list into a set, thereby removing duplicates, and then back
|
|||
into a list.
|
||||
|
||||
|
||||
How do you remove multiple items from a list
|
||||
--------------------------------------------
|
||||
How do you remove multiple items from a list?
|
||||
---------------------------------------------
|
||||
|
||||
As with removing duplicates, explicitly iterating in reverse with a
|
||||
delete condition is one possibility. However, it is easier and faster
|
||||
to use slice replacement with an implicit or explicit forward iteration.
|
||||
Here are three variations.::
|
||||
Here are three variations::
|
||||
|
||||
mylist[:] = filter(keep_function, mylist)
|
||||
mylist[:] = (x for x in mylist if keep_condition)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue