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

russ.pobox at gmail.com russ.pobox at gmail.com
Wed Jun 19 12:32:42 EDT 2013


>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...

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!



More information about the Python-list mailing list