what does 'for _ in range()' mean?
Matteo Dell'Amico
della at toglimi.linux.it
Wed Jul 28 05:21:39 EDT 2004
Roy Smith wrote:
> I've never heard of that convention before. Is it some python-specific
> thing, or is my ignorance more global in scope?
I have seen it in logic and functional programming, where '_' -
differently from python - has a special meaning: assignments to '_' are
discarded in functional programming and
I guess that it's value in the interpreter, instead, comes from perl's $_.
> In any case, I'd vote for some more useful variable name. In the above
> case, something like connectionNumber or whatever would be more
> self-explanitory.
In that case, I interpret is as this: that loop has to be iterated 20
times, and the looping variable is uninfluent. In this cases, again by
convention, in C programs the variable is often called "i".
--
Ciao,
Matteo
More information about the Python-list
mailing list