pytoolz / pytoolz/toolz

pluck_in

Open
#236 2 comments 1 reaction 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.