cnb wrote:
For a big nbr of it might matter? Is av_grade O(n*2) and the first O(n) when it comes to adding or is "sum x for x in y" just traversing the list ones, accumulating the values, it doesnt first build the list and then travese it for sum?
sum() doesn't build a list, but even if it would do that, it'd still be O(n) -- looping over an array twice doesn't change the time complexity.
to find out which one's actually faster, benchmark them. </F> -- http://mail.python.org/mailman/listinfo/python-list