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

Peter Hansen peter at engcorp.com
Wed Jul 28 18:32:54 EDT 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