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!Thanks for the informative reply Mr. Matthew