related lists mean value

John Posner jjposner at optimum.net
Mon Mar 8 21:43:58 EST 2010


On 3/8/2010 9:39 PM, John Posner wrote:

<snip>

> # gather data
> tally_dict = defaultdict(Tally)
> for i in range(len(x)):
> obj = tally_dict[y[i]]
> obj.id = y[i]                 <--- statement redundant, remove it
> obj.total += x[i]
> obj.count += 1

-John





More information about the Python-list mailing list