Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #48803

Re: Idea for key parameter in all() builting, would it be feasible?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!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.023
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'example:': 0.03; 'true,': 0.05; '21,': 0.07; 'subject:would': 0.07; 'yeah,': 0.09; 'bool': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'guilty': 0.16; 'lambda': 0.16; 'subject:key': 0.16; 'superfluous': 0.16; 'thursday,': 0.16; 'wrote:': 0.18; 'example': 0.22; 'fairly': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'on,': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'that.': 0.31; '>>>>': 0.31; 'trivial': 0.31; 'subject:all': 0.32; 'fri,': 0.33; 'actual': 0.34; 'comment': 0.34; 'problem': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; "didn't": 0.36; 'subject:?': 0.36; 'sometimes': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'short': 0.38; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'skip:x 10': 0.40; 'even': 0.60; 'expression': 0.60; 'times': 0.62; 'making': 0.63; 'email addr:gmail.com': 0.63; '20,': 0.68; 'attention': 0.75; 'pardon': 0.84; 'subject:Idea': 0.84; 'acknowledge': 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=UAOjieXiEHGxJBX2dxf22YkPzTpsUGcg1a1DcF5oFAY=; b=e6jGBfdXCHy07PKW06dWoy63UZwXjr1eH1H7KgIfJqRdFqhAQ+kCoOYtbkbR7ZeerX b5qSLfzPMUqzw7/FynmQId2euiTYDSTUmz6Qfem8QzCel3RBqEdDUonmwVpfzsco+AY5 m7wUkoD7JEDF6SfgpZLdxDPf9Oh88xYqJpnvdZq3M8m755ySsfLrS7dVSyGIWVscqC6i s7Wa9GWXcNgs7UIPawuuz50g+Sad0c65wIDnABGfGVWwC/XWROJOW1oeWvNkg46vcfol frTTiUMd3wD2RUZ2cbjaJ01ffOkz+tPKsTUmxndf7172dfgls0IIpSoGtV3FBp/64Hnj 39Sw==
MIME-Version 1.0
X-Received by 10.220.48.17 with SMTP id p17mr3036594vcf.97.1371743292837; Thu, 20 Jun 2013 08:48:12 -0700 (PDT)
In-Reply-To <e55a88ed-b603-454e-b027-09160866cad6@googlegroups.com>
References <9150d9b7-e488-4f9f-beff-4a140bcc78f0@googlegroups.com> <mailman.3619.1371725131.3114.python-list@python.org> <e55a88ed-b603-454e-b027-09160866cad6@googlegroups.com>
Date Fri, 21 Jun 2013 01:48:12 +1000
Subject Re: Idea for key parameter in all() builting, would it be feasible?
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3628.1371743295.3114.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1371743295 news.xs4all.nl 15973 [2001:888:2000:d::a6]:45770
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:48803

Show key headers only | View raw


On Fri, Jun 21, 2013 at 12:49 AM, Russel Walker <russ.pobox@gmail.com> wrote:
> On Thursday, June 20, 2013 12:45:27 PM UTC+2, Antoon Pardon wrote:
>> Op 19-06-13 18:14, russ.pobox@gmail.com schreef:
>>
>> >
>>
>> >>>> all(map(lambda x: bool(x), xrange(10**9)))
>>
>> Since you already have your answer, I just like to get your attention
>> to the fact the the lambda is superfluous here. Your expression
>> above is equivallent to
>>
>>   all(map(bool, xrange(10**9)))
>
> That's true, I didn't notice that. Although it was a trivial example I was setting up from the actual code and couldn't think of what to shove inside lambda so bool got the short straw.

Yeah, I've been guilty of that fairly often - making a trivial example
that can be trivialized even more. Sometimes all you need to do is
acknowledge it with a comment and move on, other times the additional
trivialization is a clue to the actual problem :)

In this particular case, all() will boolify anyway, so you don't even
need map. But that would completely destroy your example:

all(xrange(10**9)) # Doesn't help with figuring out the original issue!

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Idea for key parameter in all() builting, would it be feasible? russ.pobox@gmail.com - 2013-06-19 09:14 -0700
  Re: Idea for key parameter in all() builting, would it be feasible? Chris Angelico <rosuav@gmail.com> - 2013-06-20 02:20 +1000
  Re: Idea for key parameter in all() builting, would it be feasible? russ.pobox@gmail.com - 2013-06-19 09:32 -0700
    Re: Idea for key parameter in all() builting, would it be feasible? Chris Angelico <rosuav@gmail.com> - 2013-06-20 02:39 +1000
      Re: Idea for key parameter in all() builting, would it be feasible? Russel Walker <russ.pobox@gmail.com> - 2013-06-20 03:05 -0700
  Re: Idea for key parameter in all() builting, would it be feasible? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-06-20 12:45 +0200
    Re: Idea for key parameter in all() builting, would it be feasible? Russel Walker <russ.pobox@gmail.com> - 2013-06-20 07:49 -0700
      Re: Idea for key parameter in all() builting, would it be feasible? Chris Angelico <rosuav@gmail.com> - 2013-06-21 01:48 +1000

csiph-web