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

Chris Angelico rosuav at gmail.com
Wed Jun 19 12:39:30 EDT 2013


On Thu, Jun 20, 2013 at 2:32 AM,  <russ.pobox at 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 at 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



More information about the Python-list mailing list