Message from discussion
Adding list.pluck()
Received: by 10.216.202.74 with SMTP id c52mr1014483weo.6.1338585988886;
Fri, 01 Jun 2012 14:26:28 -0700 (PDT)
X-BeenThere: python-ideas@googlegroups.com
Received: by 10.180.93.34 with SMTP id cr2ls1020867wib.2.gmail; Fri, 01 Jun
2012 14:26:28 -0700 (PDT)
Received: by 10.216.202.74 with SMTP id c52mr1014476weo.6.1338585988621;
Fri, 01 Jun 2012 14:26:28 -0700 (PDT)
Received: by 10.216.202.74 with SMTP id c52mr1014475weo.6.1338585988607;
Fri, 01 Jun 2012 14:26:28 -0700 (PDT)
Return-Path: <python-ideas-bounces+python-ideas-garchive-35620=googlegroups....@python.org>
Received: from mail.python.org (mail.python.org. [82.94.164.166])
by gmr-mx.google.com with ESMTPS id cb10si2618110wib.2.2012.06.01.14.26.28
(version=TLSv1/SSLv3 cipher=OTHER);
Fri, 01 Jun 2012 14:26:28 -0700 (PDT)
Received-SPF: pass (google.com: domain of python-ideas-bounces+python-ideas-garchive-35620=googlegroups....@python.org designates 82.94.164.166 as permitted sender) client-ip=82.94.164.166;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of python-ideas-bounces+python-ideas-garchive-35620=googlegroups....@python.org designates 82.94.164.166 as permitted sender) smtp.mail=python-ideas-bounces+python-ideas-garchive-35620=googlegroups....@python.org; dkim=pass header...@python.org
Received: from albatross.python.org (localhost [127.0.0.1])
by mail.python.org (Postfix) with ESMTP id 3W3zBD2KxzzN6L
for <python-ideas-garchive-35620@googlegroups.com>; Fri, 1 Jun 2012 23:26:28 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=python.org; s=200901;
t=1338585988; bh=HGWhKiHWVYx0lozdCqRnkf74QJpv9MR9aeo72GKfct8=;
h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:To:
Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:
List-Subscribe:Content-Type:Content-Transfer-Encoding:Sender;
b=EZvp1HXfPC+EhH+jtuvYMTYk5ED6tSjRyZxZejo8QMYAllx5oKAXAGRhTTgD1qymO
4yqh7/0yq6RNqgocyWKBBdD/RGLtZD6joNGvUBl8MAGiy9Pj9wcp8gvAH26OLGoRz4
TLqL2Bz9tfNnxG5KsP/JnVyG9mg7w3iqg9XnWVvg=
X-Original-To: python-id...@python.org
Delivered-To: python-id...@mail.python.org
Received: from albatross.python.org (localhost [127.0.0.1])
by mail.python.org (Postfix) with ESMTP id 3W3z9P4hHMzNBL
for <python-id...@python.org>; Fri, 1 Jun 2012 23:25:45 +0200 (CEST)
X-Spam-Status: OK 0.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.04;
'subject:Python': 0.05; 'subject:()': 0.09; 'url:github': 0.09;
'python': 0.10; 'received:74.125.82.44': 0.15; 'sat,': 0.15;
'email addr:phdru.name': 0.16; 'map:': 0.16; 'subject:Adding':
0.16; 'subject:ideas': 0.16; 'wrote:': 0.17; 'implementing': 0.18;
'subject:] ': 0.19; 'header:In-Reply-To:1': 0.23; 'message-
id:@mail.gmail.com': 0.27; 'maybe': 0.27; 'common': 0.28;
'lists?': 0.29; 'url:mailman': 0.29; 'function': 0.29; 'fri,':
0.30; 'url:python': 0.31; 'objects': 0.32; 'url:listinfo': 0.33;
'javascript.': 0.33; 'library.': 0.33; 'received:74.125.82': 0.34;
'received:google.com': 0.34; 'add': 0.35; 'list': 0.35; 'version':
0.35; 'url:org': 0.35; 'programmers': 0.36; 'received:74.125':
0.37; 'skip:_ 40': 0.37; 'email addr:python.org': 0.38; 'pm,':
0.38; 'skip:o 20': 0.38; 'mailing': 0.38; 'to:addr:python.org':
0.39; 'header:Received:5': 0.39; 'most': 0.62; 'to:addr:python-
ideas': 0.75
Received: from localhost (HELO mail.python.org) (127.0.0.1)
by albatross.python.org with SMTP; 01 Jun 2012 23:25:45 +0200
Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com [74.125.82.44])
(using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
(No client certificate requested)
by mail.python.org (Postfix) with ESMTPS
for <python-id...@python.org>; Fri, 1 Jun 2012 23:25:45 +0200 (CEST)
Received: by wgbdr13 with SMTP id dr13so1634555wgb.13
for <python-id...@python.org>; Fri, 01 Jun 2012 14:25:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to
:content-type:content-transfer-encoding;
bh=sTm3kCYpj7sxe5G9SxaP0y0aFKa5ITPQSQ9Vme9uFDU=;
b=hivP73DYIZ5oIJRUYCSmsyICcPsoWFSYCi7KDkBOgGIutwx8F3FiodLhHxDt7uT7Vt
Bwa6Ms8lUhg8EGBWv0pRatGePRQl2uBitetj6qbnUXfK4Ghj89f/N1czrxiqK3gLh4tw
9JRi/MI6/8biu2E7RJ9aK049EoXlcB55eumQv7P9DV0uRy2rzq+5Kq7QuGqmM/Iesplp
q5kCJklXon6q4+9IDdry3RibTb+XecH4el7n3Mif0+9b35B2RxudroH14xNBFs7WogUG
FywHZaACs+P9qVApL0hO8/XtEvPEZ9WSLqLiEnSAV/YK0YOc3VhKj1DL6OvxEq9aY12J
keMA==
Received: by 10.216.209.95 with SMTP id r73mr3238693weo.157.1338585945029;
Fri, 01 Jun 2012 14:25:45 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.180.79.97 with HTTP; Fri, 1 Jun 2012 14:25:24 -0700 (PDT)
In-Reply-To: <20120601211630.GA24...@iskra.aviel.ru>
References: <CAJTdGt2KYMwQ_Rv3T4kfwH26wDyZDq4ip2xev6HooKu03LO...@mail.gmail.com>
<20120601211630.GA24...@iskra.aviel.ru>
From: Alexandre Zani <alexandre.z...@gmail.com>
Date: Fri, 1 Jun 2012 14:25:24 -0700
Message-ID: <CAJVMpooaiU2_fWAHe2oSSatZvWfYmEYW8pY7r68D4h_8D5i...@mail.gmail.com>
To: python-id...@python.org
Subject: Re: [Python-ideas] Adding list.pluck()
X-BeenThere: python-id...@python.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Discussions of speculative Python language ideas
<python-ideas.python.org>
List-Unsubscribe: <http://mail.python.org/mailman/options/python-ideas>,
<mailto:python-ideas-requ...@python.org?subject=unsubscribe>
List-Archive: <http://mail.python.org/pipermail/python-ideas>
List-Post: <mailto:python-id...@python.org>
List-Help: <mailto:python-ideas-requ...@python.org?subject=help>
List-Subscribe: <http://mail.python.org/mailman/listinfo/python-ideas>,
<mailto:python-ideas-requ...@python.org?subject=subscribe>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Sender: python-ideas-bounces+python-ideas-garchive-35620=googlegroups....@python.org
Errors-To: python-ideas-bounces+python-ideas-garchive-35620=googlegroups....@python.org
What if it's a list of objects instead of a list of dicts? List
comprehension already makes this easy:
[i['name'] for i in l]
I don't think this would add as much in python as it adds in javascript.
On Fri, Jun 1, 2012 at 2:16 PM, Oleg Broytman <p...@phdru.name> wrote:
> On Sat, Jun 02, 2012 at 12:10:03AM +0300, Cenk Alt?? <cenka...@gmail.com>=
wrote:
>> 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 iterabl=
es?
>
> =A0 Like operator.attrgetter?
> http://docs.python.org/library/operator.html#operator.attrgetter
>
> Oleg.
> --
> =A0 =A0 Oleg Broytman =A0 =A0 =A0 =A0 =A0 =A0http://phdru.name/ =A0 =A0 =
=A0 =A0 =A0 =A0...@phdru.name
> =A0 =A0 =A0 =A0 =A0 Programmers don't die, they just GOSUB without RETURN.
> _______________________________________________
> Python-ideas mailing list
> Python-id...@python.org
> http://mail.python.org/mailman/listinfo/python-ideas
_______________________________________________
Python-ideas mailing list
Python-id...@python.org
http://mail.python.org/mailman/listinfo/python-ideas