Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58877
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'class,': 0.07; 'elegant': 0.07; 'subject:code': 0.07; 'arguments': 0.09; 'python': 0.11; 'args.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iterable': 0.16; 'iterable,': 0.16; 'lambda': 0.16; 'stdlib.': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'library': 0.18; 'code,': 0.22; 'separate': 0.22; 'case.': 0.24; 'tend': 0.24; 'fairly': 0.24; "haven't": 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'needed.': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'probably': 0.32; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'version': 0.36; "i'll": 0.36; 'easily': 0.37; 'nov': 0.38; 'needed': 0.38; 'to:addr:python- list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'easy': 0.60; 'map': 0.64; 'taking': 0.65; 'so...': 0.84; 'remember,': 0.93; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=+P6Zs1QZRZ/OGJVMsDz3lvayVMBuaQRtOWRLHJELDPY=; b=dUHU1lbRXyFi6HdR09H9kijZXuAlm4uAZ2RAeWxsxfNht1nTzmNm1sAzoCctG3StgO MDlJxdAQFACfCXREcrPB/D2uZXUlHljn/QOANh1VC2jc/I2xpwcV70pDdy9TXhoCmkpe OQHjzsM7+RmolY6VjUIk8ua3KPJV0Qu3FbSggVSP2eLMhzyDGQ1q3Qmge5HJA6FIBSCs 0G7v1Teh6Yk+ZcxwL2FqVwsnz/iplAtqp9KaMJCz2RRSlM9iHYADscxz3UqoSEVNvE27 ynX94i21u2kKXN7scSWSBzpyJJuglRnO39GAaSihsp4CNJSXFVVAC2EH64eTF1QTmZQz Xo/A== |
| MIME-Version | 1.0 |
| X-Received | by 10.68.185.68 with SMTP id fa4mr17658089pbc.136.1383949975468; Fri, 08 Nov 2013 14:32:55 -0800 (PST) |
| In-Reply-To | <fbbabb45-f0e3-4e7f-968f-9822607c450a@googlegroups.com> |
| References | <fbbabb45-f0e3-4e7f-968f-9822607c450a@googlegroups.com> |
| Date | Sat, 9 Nov 2013 09:32:55 +1100 |
| Subject | Re: my favorite line of py code so far |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2265.1383949984.18130.python-list@python.org> (permalink) |
| Lines | 16 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1383949984 news.xs4all.nl 15908 [2001:888:2000:d::a6]:36892 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:58877 |
Show key headers only | View raw
On Sat, Nov 9, 2013 at 9:22 AM, Peter Cacioppi <peter.cacioppi@gmail.com> wrote: > my fav so far is this > > _ = lambda c : lambda x : c(*x) > > c can be any calleable and x any iterable, but I tend to use it with a class, and then map _(class) over the result of a zip. > > It must be in the library somewhere, but I haven't found it. I'm never sure what to call it, so I just reroll it into _ as needed. It's pretty easy for me to remember, but I'll probably tattoo it on my chest just in case. So... for any given class, it returns a tweaked version that unpacks an iterable of its arguments instead of taking separate args. Interesting, perhaps, but not something that'll be needed in the stdlib. But as a demo of how easily Python primitives can be combined into some fairly elegant code, I think this is as good as any! ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-08 14:22 -0800
Re: my favorite line of py code so far Chris Angelico <rosuav@gmail.com> - 2013-11-09 09:32 +1100
Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-08 14:43 -0800
Re: my favorite line of py code so far Peter Otten <__peter__@web.de> - 2013-11-09 08:12 +0100
Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-09 01:23 -0800
Re: my favorite line of py code so far Chris Angelico <rosuav@gmail.com> - 2013-11-09 20:28 +1100
Re: my favorite line of py code so far Paul Rubin <no.email@nospam.invalid> - 2013-11-09 01:49 -0800
Re: my favorite line of py code so far Peter Otten <__peter__@web.de> - 2013-11-09 12:49 +0100
Re: my favorite line of py code so far Stefan Behnel <stefan_ml@behnel.de> - 2013-11-09 13:41 +0100
Re: my favorite line of py code so far Chris Angelico <rosuav@gmail.com> - 2013-11-09 23:45 +1100
Re: my favorite line of py code so far Peter Otten <__peter__@web.de> - 2013-11-09 14:49 +0100
Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-10 00:57 -0800
Re: my favorite line of py code so far Chris Angelico <rosuav@gmail.com> - 2013-11-10 21:23 +1100
Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-10 00:59 -0800
Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-10 16:00 -0800
csiph-web