Re: Is using range() in for loops really Pythonic?
On 2008-05-12, Ben Finney <bignose+hate s-spam@benfinney. id.auwrote:
I guess people who standardize on loop_count never nest loops. :)
And when somebody adds a nested loop things fall apart.
--
Grant Edwards grante Yow! BARBARA STANWYCK makes
at me nervous!!
visi.com
On 2008-05-12, Ben Finney <bignose+hate s-spam@benfinney. id.auwrote:
Paddy <paddy3118@goog lemail.comwrite s:
>
>
The problem with all of these names is that they also have long
precedent as names of values that *will* be used inside the loop.
>
>I've used Fortran and C and so would tend to use either i,j,k as the
>unused loop variable above, or, for clarity, call it something
>descriptive like loop_count, if the loop body would be clearer.
>unused loop variable above, or, for clarity, call it something
>descriptive like loop_count, if the loop body would be clearer.
The problem with all of these names is that they also have long
precedent as names of values that *will* be used inside the loop.
Because of the precedent of those names, choosing one of those
names doesn't make it clear to the reader that the value is
never used; they have no indication from you of that until
they look over the code a few times. It's implicit rather than
explicit.
names doesn't make it clear to the reader that the value is
never used; they have no indication from you of that until
they look over the code a few times. It's implicit rather than
explicit.
--
Grant Edwards grante Yow! BARBARA STANWYCK makes
at me nervous!!
visi.com
Comment