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


Groups > comp.lang.python > #48727

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

References <9150d9b7-e488-4f9f-beff-4a140bcc78f0@googlegroups.com> <e536e8b0-c0ad-4a76-b17b-11f602f60338@googlegroups.com>
Date 2013-06-20 02:39 +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.3586.1371659978.3114.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Jun 20, 2013 at 2:32 AM,  <russ.pobox@gmail.com> wrote:
>>All you need is the iterator version of map(). In Python 3, that's the
>>normal map(); in Python 2, use this:
>
>>>>> from itertools import imap
>>>>> all(imap(lambda x: bool(x), xrange(10**9)))
>>False
>
>>It's roughly instant, like you would expect.
>
>>ChrisA
>
> This probably isn't the way to post a reply on your own thread (I added an angle bracket to every line above :P) but last time clicked reply to author not knowing that is email. Anyways...

If you're getting this via the mailing list, just hit Reply, and then
change the To: address to python-list@python.org - that's the simplest
(assuming you don't have a Reply To List feature, but you wouldn't be
saying the above if you had one). That way, you get a citation line,
quoted text is marked, and it's taken a minimum of effort.

> Thanks, I like itertools but had no idea imap. Although I did suspect Python3 would have something to say about this just to make me envious :D
>
> It works like a charm!

Awesome! Hey, if you *can* switch to Py3, do try to. It has heaps of
improvements, and it has a future. :)

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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