> Then I'm very confused as to how things are being done, so I will shut
> up. There's not enough information here to give performance advice
> without actually being a subject-matter expert already.

Short version: In this specific case "weights" is a 5,147 element list of 
floats, and "input" is a 10 element list of integers which has the indexes of 
the 10 elements in weights that he wants to add up.

sum_ = 0
for key in input:
    sum_ += weights[key]

vs

sum_ = sum(weights[key] for key in input)

vs... other ways
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to