At my day job, I write code for a company called Berkeley Data Systems. (They found me through this blog, actually. It's been a good place to work.) Our first product is free online backup at mozy.com . Our second beta release was yesterday; the obvious problems have been fixed, so I feel reasonably good about blogging about it. Our back end, which is the most algorithmically complex part -- as opposed to fighting-Microsoft-APIs complex, as we have to in our desktop client -- is 90% in python with one C extension for speed. We (well, they, since I wasn't at the company at that point) initially chose Python for speed of development, and it's definitely fulfilled that expectation. (It's also lived up to its reputation for readability, in that the Python code has had 3 different developers -- in serial -- with very quick ramp-ups in each case. Python's succinctness and and one-obvious-way-to-do-it philosophy played a big part in this.) If you try it out, pleas
Comments
print "Yrg'f fnl bf.yvfgqve(pjq)==['n', 'o']. Ba gur svefg eha guebhtu gur sbe ybbc, qve=='n', naq gur guernq vf fgnegrq. Vs nsgre gur guernq vf fgnegrq, ohg orsber vg trgf gb vaibxr sbb(qve) gur qve inevnoyr vf frg gb 'o' (orpnhfr gur ybbc vf eha gur frpbaq gvzr) gura sbb('o') jvyy or pnyyrq naq lbh'yy frr 'o\\ao\\a'".decode('rot13')
for dir in os.listdir(os.getcwd()):
threading.Thread(target=foo, args=(dir,)).start()
Is the right way to do it ? Then dir would be evaluated at the Thread creation.
lambda dir=dir: foo(dir)
OTOH, in this case there's already a standard way of passing arguments, as shown above.
using threading for output is a friend of lambda.
Harald Armin Massa notonblogger
How else would we say:
total_size = reduce( os.listdir(os.getcwd()), lambda a,x: a+os.stat(x).st_size,0 )
short, clear, and to the point