You shouldn't be. Loops are notorious for being slow due to the iterator being accessed and manipulated. You have just discovered in Python what we've known in Perl for years: less code is faster. We use map and grep liberally in Perl and then get accused of being "too clever". Welcome to reality!
You shouldn't be. Loops are notorious for being slow due to the iterator being accessed and manipulated. You have just discovered in Python what we've known in Perl for years: less code is faster. We use
map
andgrep
liberally in Perl and then get accused of being "too clever". Welcome to reality!It depends on what is happening under the hood. Less code doesn't need necessarily faster and vice versa.
Yeah it depends.i totally agree with your point
Thanks for the informative reply Mr. Matthew