for loop without variable
Carl Banks
pavlovevidence at gmail.com
Wed Jan 9 22:44:53 EST 2008
On Wed, 09 Jan 2008 14:25:36 -0800, erik gartz wrote:
> 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.
IIRC, in pylint you can turn off checking for a particular symbol. I had
to edit a .pylintrc file (location may vary on Windows) and there was a
declaration in the file that listed symbols to ignore.
Last time I bothered running it, I added "id" to that list, since I use
it often (bad habit) and almost never use the builtin id, but still
wanted shadowing warnings for other symbols.
Carl Banks
More information about the Python-list
mailing list