Is using range() in for loops really Pythonic?

Terry Reedy tjreedy at udel.edu
Mon May 12 19:21:41 EDT 2008


"Ben Finney" <bignose+hates-spam at benfinney.id.au> wrote in message 
news:877ie06kdl.fsf at benfinney.id.au...
| So, when not using the values that come from the controlling iterator,
| it's good to make that explicit. If Python supported it, we might
| prefer to use no name at all for something that isn't used, but the
| 'for' syntax doesn't allow that.

But I presume it could if [target 'in'] were optional.

for range(n): <stuff to do n times>

It is possible this has been proposed and rejected,
but I have no specific memory.

tjr






More information about the Python-list mailing list