3 ms·
Yes, as a dev who started in Python and has done more JS recently, I’ve really come to believe that the chaining of in-line functions is a better approach in th
by earthboundkid 6y ago
Yes, as a dev who started in Python and has done more JS recently, I’ve really come to believe that the chaining of in-line functions is a better approach in the end. Python theoretically has the advantage of working with lists or iterators, but in practice, all you really use are lists.
- sammorrowdrums 6y agoTo 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
- BiteCode_dev 6y ago> all you really use are lists. The more you get experience in Python, and the less you use specifically lists. In fact, you can spot people getting confortable with the language when they start importing itertools, unless they are data scientists, of course.