Is there a better, more FP style, more Pythonic way to
write this:

def compute_vectors(samples, dset):
        vectors = {}
        for d in dset:
                vectors[d] = [sample.get_val(d) for sample in
samples]
        return vectors

Namely, I'd like to get rid of the initilization
(vectors = {}) and also the loop  Yet, I'd hate to put
an assignment into Python's FP list comprehensions.

Ideally, I'd like something like this:
vectors.dict_add({d:result}) for [sample.get_val(d)
for sample in samples for d in dset].  

Is there anything like that?  Am I missing the
picture?

Thanks.

PS If possible, please cc me on all responses, thanks.


        
                
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to