erik gartz schrieb: > 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.
The underscore is used as "discarded" identifier. So maybe for _ in xrange(10): ... works. Diez -- http://mail.python.org/mailman/listinfo/python-list