Re:Python idioms
by mixmastamyk on Sunday June 12, 2011 @07:13PM
(#2647621)
I read many years ago that '%s%s' % (a,b) was faster than a + b, the reason given that it was done in C. But after reading this thread and trying myself, it seems to be false also. On Py 2.6:
Perhaps it changed in new versions of Python, but either way, I guess I'll be using the % form less than I used to.
[ Parent
| on HN ]
Re:Python idioms
by wahnfrieden on Monday June 13, 2011 @07:50PM
(#2651221)
Use whatever is clearest to read, since the benchmarks vary upon circumstance, VM, and VM version.