This is one of the advantages of languages with optimizing compilers. In Python, there's a tradeoff between clarity and performance. But in C++ for example, your for-loop is just as fast as any library's for-loop.
Edit: My assumption is that many Python libraries are written in C for performance, but maybe that's not the case.