On Mon, Nov 29, 2021 at 5:54 AM Christopher Barker <python...@gmail.com> wrote:
>
> On Sun, Nov 28, 2021 at 9:30 AM Evpok Padding <evpok.padd...@gmail.com> wrote:
>>
>> All apologies if it has been clarified earlier, but if you dislike nested 
>> method calls what is wrong with operating on generators as in
>>
>> ```pycon
>> >>> itr = (i**2 for i in range(8))
>> >>> itr = (i-1 for i in itr if i > 0)
>> >>> list(itr)
>> [0, 3, 8, 15, 24, 35, 48]
>> ```
>> +1 -- what I don't like about itertools is that it's not comprehension 
>> friendly. I'm still confused a bit about this:
>
>
> Back in the day Python had map, filter, and reduce.
>
> Then comprehensions were added, which are another way to express map and 
> filter in one go.
>
> I really like comprehensions.
>
> But since then, there has been an informal movement, if you can call it that, 
> back to map and filter. Itertools is great, but it's not all that compatible 
> with comprehensions :-(
>

Citation needed? What informal movement has there been, and where?

The only problem with itertools and comprehensions is that you get
code written in two different ways. I don't recall seeing anyone say
"don't use a comprehension if you're going to then use itertools.tee
on it" or anything like that.

Maybe I just don't hang out in the right places?

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/3RFT35SIE2MGXP6I2E4CFLABCJTLSOV5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to