while true: !!!
ben.hutchings at roundpoint.com
Tue Dec 12 13:15:16 CET 2000
"Greg Jorgensen" <gregj at pobox.com> writes:
> A flame war broke out a few years ago in comp.lang.c++ over which
> was better: for ( i=0; i < N; i++ ) or for (i=0; i < N; ++i ). The
> result is exactly the same, and K&R use the first (postincrement)
> idiom, but it turns out that ++i is usually a tiny bit more
> efficient than i++.
For iterators of built-in types (like int) it's unlikely to matter,
but for iterators of user-defined types the latter may be less
efficient as it's harder for the compiler to optimise the code for the
overloaded post-increment operator.
Any opinions expressed are my own and not necessarily those of Roundpoint.
More information about the Python-list