From 93bee01a63f713fb192d8a11397be629732a7fe7 Mon Sep 17 00:00:00 2001 From: Michael Bianco Date: Thu, 14 Dec 2023 06:55:39 -0700 Subject: [PATCH] feat: allow multiple keys to be passed to pluck --- funcy/colls.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/funcy/colls.py b/funcy/colls.py index 6acfd53..fe31731 100644 --- a/funcy/colls.py +++ b/funcy/colls.py @@ -349,8 +349,11 @@ def where(mappings, **cond): return filter(match, mappings) def pluck(key, mappings): - """Iterates over values for key in mappings.""" - return map(itemgetter(key), mappings) + """Iterates over values for key, or multiple keys, in mappings.""" + if isinstance(key, (list, tuple)): + return map(itemgetter(*key), mappings) + else: + return map(itemgetter(key), mappings) def pluck_attr(attr, objects): """Iterates over values of given attribute of given objects."""