The third thing seems like premature optimization. Don't worry about efficiency until 1) you know it's a problem, and 2) you have data that proves your new code is better.
Excepting obvious cases, of course, where you KNOW it'll be better and doesn't require you to have to do any extra work (e.g. using xrange instead of range is typically good).
1
u/AustinCorgiBart Jun 20 '13
The third thing seems like premature optimization. Don't worry about efficiency until 1) you know it's a problem, and 2) you have data that proves your new code is better.
Excepting obvious cases, of course, where you KNOW it'll be better and doesn't require you to have to do any extra work (e.g. using xrange instead of range is typically good).