
On Sun, Nov 28, 2021 at 9:30 AM Evpok Padding <evpok.padding@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 :-( I'm a bit confused as to why comprehensions seem to have become second-class citizens myself. Granted, deeply nesting multiple comprehensions is pretty ugly, so a fluent interface to nesting transformations on iterables does have its appeal. -CHB -- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython