pluck_in
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.2k
- Forks
- 280
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 4
Description
Consider the following data:
data = [
{'name': 'Alice', 'location': {'city': 'LA', 'state': 'CA'}}
{'name': 'Bob', 'location': {'city': 'NYC', 'state': 'NY'}}
]
How do we get all of the states? In following tradition with update_in consider
>>> list(pluck_in(['name', 'city'], data))
['LA', 'NYC']
Thoughts?
This might be a little silly though. Presumably this is just composed applications of pluck
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing pluck and update_in operations to determine whether nested extraction is already expressible through composition. Compare the proposed pluck_in(['name', 'city'], data) behavior with the example, then check whether tests for pluck or update_in provide a suitable place to define the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100