3 ms·
To be fair many tools use iterator types that are not lists like Django querysets. I feel the nice thing in Python is generator expressions, so for lots of cod
by sammorrowdrums 6y ago
To be fair many tools use iterator types that are not lists like Django querysets.
I feel the nice thing in Python is generator expressions, so for lots of code you can decrease the memory footprint and speed some code up through easy lazy evaluation.
I do appreciate the clarity of function chaining, and I think Rust made particularly good decisions around iteration in that way.
Function chaining ideally needs good ways to break iteration, skip and things, and JS isn't very feature rich beyond the basic map, reduce, forEach. It feels very incomplete compared to a lot of languages that offer that stuff. Hence the popularity of underscore and then lodash.
- earthboundkid 6y agoIf you’re doing a list comprehension with a Django queryset, you’re risking having a million accidental DB requests