It's curious how in #python making things readable often results in writing for loops nicely. While in #rustlang you make the same kind of code readable by making good use of iterator combinators and removing the loops.
@flub because in python, iterators have a horrible design.
I'm convinced it's mostly caused by how blocks are defined in whitespace. (This is also a practical reason why whitespace as block definitions, sucks).
And partially because in python, lambdas, procs and closures are an afterthought, retrofitted , poorly (probably due to the whitespace thing).
And lastly, because in python scoping is a hot mess (slightly better than Ruby's or JS's, but still bad).
@flub what I find most frustrating, though, is how very different the performance of iterators vs loops can be.
In #rust, refactoring from one to another might have some small effect. But in #python , I need to know the intricacies of both, when refactoring. Last week I refactored a python iterators into a loop, no functional change, and a run went from 13 seconds to over 4 minutes! Apparently smth with memory allocations and -copies. As leaky an abstraction I have ever seen.
@berkes@flub actually my experience is that in Rust, using iterators is often faster than using loops, since it gives the compiler more power and information
Add comment