Avoid function calls in a for loop test part