Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #40 from sergiors/master
Browse files Browse the repository at this point in the history
Using list comprehension to pick
  • Loading branch information
jackfirth committed Sep 5, 2020
2 parents 5c3bf33 + eaae4b8 commit 70efc62
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions pyramda/dictionary/pick.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@

@curry
def pick(keys, dict):
picked_dict = {}
for k in keys:
if k in dict:
picked_dict[k] = dict[k]
return picked_dict
return {k: v for k, v in dict.items() if k in keys}

0 comments on commit 70efc62

Please sign in to comment.