(July 8 2005) Apparently I got linked by some PHP sites, and while there were a few well-reasoned comments here I mostly just got people who only knew PHP reacting like I told them their firstborn was ugly. These people tended to give variants on one or more themes: All environments have warts, so PHP is no worse than anything else in this respect I can work around PHP's problems, ergo they are not really problems You aren't experienced enough in PHP to judge it yet As to the first, it is true that PHP is not alone in having warts. However, the lack of qualitative difference does not mean that the quantitative difference is insignificant. Similarly, problems can be worked around, but languages/environments designed by people with more foresight and, to put it bluntly, clue, simply don't make the kind of really boneheaded architecture mistakes that you can't help but run into on a daily baisis in PHP. Finally, as I noted in my original introduction, with PHP, ...
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