Hacker News new | ask | show | jobs
by pdonis 4662 days ago
using xrange made it slightly faster

That's what I would expect, since xrange works like a generator; but the internals of its implementation in CPython back when the article ran its original tests were evidently less efficient than they are now.

the difference was pretty small

I suspect that's because the strings being concatenated are really small (the largest will only be 5 bytes for n=10000). I would expect the difference to get bigger as the individual strings get larger.