what does 'for _ in range()' mean?
Peter Otten
__peter__ at web.de
Wed Jul 28 09:50:30 EDT 2004
Michael Charlton wrote:
> I've just tried it on some toy code and as always I run pychecker on it.
> So with
>
> def spam():
> for i in range(10):
> print 'a'
>
> I get "Local variable (i) not used". But with the following:
>
> def spam():
> for _ in range(10):
> print 'a'
>
> I get no such warning. Is pychecker aware of this convention or is it
> coincidental? I don't
Found in Config.py:
_DEFAULT_UNUSED_LIST = [ '_', 'empty', 'unused', 'dummy', ]
Peter
More information about the Python-list
mailing list