comple list slices

Fredrik Lundh fredrik at pythonware.com
Tue Feb 28 15:39:54 EST 2006


johnzenger at gmail.comwrote:

> Len(rows) recalculates each time the while loop begins.  Now that I
> think of it, "rows != []" is faster than "len(rows) > 0."

the difference is very small, and "len(rows)" is faster than "rows != []"
(the latter creates a new list for each test).

and as usual, using the correct Python spelling ("rows") is a lot faster
(about three times in 2.4, according to timeit).

</F>






More information about the Python-list mailing list