Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #48803
| References | <9150d9b7-e488-4f9f-beff-4a140bcc78f0@googlegroups.com> <mailman.3619.1371725131.3114.python-list@python.org> <e55a88ed-b603-454e-b027-09160866cad6@googlegroups.com> |
|---|---|
| Date | 2013-06-21 01:48 +1000 |
| Subject | Re: Idea for key parameter in all() builting, would it be feasible? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3628.1371743295.3114.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Find similar | Unroll 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