I have an iterator of numbers, for example a file object:
f = open("datafile.dat")
now I want to compute:
mean = get_mean(f)
sigma = get_sigma(f, mean)
What is the best implementation? Suppose that the file is big and I would like to avoid to read it twice.
get_mean()wherefsum()only accepts lists of numbers.