[Python-ideas] Adding list.pluck()

Mike Graham mikegraham at gmail.com
Fri Jun 1 23:18:45 CEST 2012

On Fri, Jun 1, 2012 at 5:10 PM, Cenk Altı <cenkalti at gmail.com> wrote:
> Hello All,
> pluck() is a beautiful function which is in underscore.js library.
> Described as "A convenient version of what is perhaps the most common
> use-case for map: extracting a list of property values."
> http://documentcloud.github.com/underscore/#pluck
> What about it implementing for python lists? And maybe for other iterables?

Using a generator expression or list comprehension to do this is so
easy and readable I don't see why we'd want something new in Python.


More information about the Python-ideas mailing list