[Python-iterators] RE: PEP 234: Iterators

Roman Suzi rnd at onego.ru
Thu May 3 00:18:19 EDT 2001


On Wed, 2 May 2001, Tim Peters wrote:

>>     >>> for k in filter(lambda k: k & 1 == 0, d):
>>     ...     print k
>>     ...
>>     4
>>     2
>>     >>>
>
>Since I checked in the change to filter() that made this work, you *might*
>guess that I knew that <wink>.  There's still a difference, and in some apps
>a crucial one:  using filter() directly materializes the entire result list
>before the loop gets going, but the filteriter class works "on demand".

Nice to see Python becomes lazy!

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Thursday, May 03, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "A conclusion is simply the place where you got tired of thinking." _/





More information about the Python-list mailing list