Skip to content

Prefer list comprehensions over map and filter#971

Merged
mpoulin merged 2 commits into
realpython:masterfrom
gbrova:gbrova/prefer-list-comps-over-map
Jan 15, 2019
Merged

Prefer list comprehensions over map and filter#971
mpoulin merged 2 commits into
realpython:masterfrom
gbrova:gbrova/prefer-list-comps-over-map

Conversation

@gbrova

@gbrova gbrova commented Jan 15, 2019

Copy link
Copy Markdown
Contributor

Fixes #968.

This PR removes the recommendation to use map over list comprehensions from the Structuring Your Project page.

This PR also removes most discussion about map and filter from the Code Style page, recommending instead generator functions and list comprehensions (as discussed in #968). Personally, I value opinionated and prescriptive guides when learning something new, but feel free to push back if the old material should stay.

Also made some minor edits, slightly expanded the discussion on list vs iterators, and added a couple of examples.

 - Remove emphasis on map and filter, in favor of generator expressions.
 - Move list comprehensions and generator expressions under "Short ways
   to manipulate lists" rather than "Filtering a list".
 - Add some examples.
@mpoulin mpoulin merged commit 1efc78a into realpython:master Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants