Making things more functional in Python

Michael Hoffman cam.ac.uk at mh391.invalid
Fri Mar 4 12:30:10 EST 2005


Steve Holden wrote:

> return dict([(d, sample.getval(d)) for d in dset for sample in samples])

That won't do what the original code does. This sets dict[d] to
samples[-1].getval(d) instead of [sample.getval(d) for sample in samples].
-- 
Michael Hoffman



More information about the Python-list mailing list