
nlightening on top of being illuminating! Discovered it through Daily Python-URL! and Ned Batchelder. I am sure my Italian is nowhere near good enough to understand his thesis but I may try giving it a bash anyway. I can always just look at the pictures :D
The quotation is taken from a poster he made to present his project. It is a brilliant looking work. The dancing part reminded me of Tim Leary in Misc.EvolutionarySurfer. Must go surfing I guess ;)
Yesterday I had a blast coding in Python. I started refactoring the code of a prototype application I wrote over roughly 6 months, that's proving too useful to stay in that state. I am glad to say that I am not as much of a potato programmer as I use to be (cf. 20060122). So today I am going to express openly my love for the setdefault method of dictionary objects!
for s in style:
reference[s] = {}
for L in length:
reference[s][L] = {}
for m in microns:
man = [lot for lot in data if lot.style == s and
lot.length == L and int(lot.micron) == m and
'W' not in lot.prefix]
bales = sum([lot.bales for lot in man if lot.team != 0])
if bales:
average = sum([lot.team * lot.bales for lot in man
if lot.team != 0]) / bales
reference[s][L][m] = {'hm': average, 'bls': bales}
if len(reference[s][L]) == 0:
reference[s].pop(L)
if len(reference[L]) == 0:
reference.pop(s)
worked but the reference dictionary turned up to be pretty scarce i.e. lots of empty cells i.e. empty dicts, which I decided to get rid of using pop. Then I remembered the setdefault method which does a great job!
for s in style:
for L in length:
for m in microns:
man = [lot for lot in data if lot.style == s and
lot.length == L and int(lot.micron) == m and
'W' not in lot.prefix]
bales = sum([lot.bales for lot in man if lot.team != 0])
if bales:
average = sum([lot.team * lot.bales for lot in man
if lot.team != 0]) / bales
reference.setdefault(s, {}).setdefault(L, {})[m] =\
{'hm': average, 'bls': bales}
is as readable and generates the proper reference straight away.
After over 2 months without swimming I went back to the pool, using one of the last 2 tickets I had for Max Dormoy (cf. 20070416). It was a shinfin training session (the first in a long time).
| distance | technic |
| 500 m | freestyle arms only, with fins for body position |
| 500 m | freestyle, with fins |
| 500 m | kick board, with fins |
| 500 m | freestyle, no fins |
blog comments powered by Disqus


