[Python-ideas] Adding list.pluck()

Mike Meyer mwm at mired.org
Sat Jun 2 01:07:04 CEST 2012


On Sat, 2 Jun 2012 00:48:04 +0300
Cenk Altı <cenkalti at gmail.com> wrote:

> l.pluck('name') is more readable IMO.

Only because you already associate "pluck" with that meaning.

As others said, "pluck" to me implies something like "pop". The list
comprehension spelling doesn't suffer from this problem, and provides
a lot more flexibility. If you don't like list comprehensions, use map
and the operator module.

Even if it is more readable, it's more semantic load. It's another
container operator (and one that's only useful in the special case of
a list of maps) people have to learn. Since it saves 0 lines of code
over either of existing mechanisms, the extra load comes for no
advantage.

-1

    <mike
-- 
Mike Meyer <mwm at mired.org>		http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org



More information about the Python-ideas mailing list