for loop without variable

erik gartz eegunnar at yahoo.com
Wed Jan 9 17:25:36 EST 2008


Hi. I'd like to be able to write a loop such as:
for i in range(10):
    pass
but without the i variable. The reason for this is I'm using pylint
and it complains about the unused variable i. I can achieve the above
with more lines of code like:
i = 0
while (i != 10):
    i += 1
Is there a concise way to accomplish this without adding extra lines
of codes? Thanks in advance for your help.



More information about the Python-list mailing list