what does 'for _ in range()' mean?

Peter Hansen peter at engcorp.com
Thu Jul 29 00:32:54 CEST 2004


David Eppstein wrote:
> In that context, it's allowed multiple times, but in some other contexts 
> it's not:
> 
>>>>def foo(_,_): pass
> 
> ... 
>   File "<stdin>", line 1
> SyntaxError: duplicate argument '_' in function definition

Uh, okay... and does Ocaml allow duplicating argument
names in whatever it has that passes for a function
definition?  This is all a reach from the original
point of the thread, which was to use it as a throw-away
control variable in a for loop...

-Peter



More information about the Python-list mailing list