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

Christopher T King squirrel at WPI.EDU
Thu Jul 29 21:24:33 CEST 2004

On Thu, 29 Jul 2004, Peter Hansen wrote:

> In that case they would be related, but is this any more than
> supposition on your part?  Is the use of _ as a throw-away in
> for loops, and perhaps even in the interpreter as "last result",
> definitely descended from its wildcard usage in functional
> languages (or, at least, Ocaml)?

I'm pretty sure they're both descended from the use of _ as both a 
throw-away and a wildcard in Prolog, as another poster pointed out.

For reference, Prolog was born in 1970, OCaml was born in 1996 (with roots 
dating back to ML in 1983), and Python was born in 1991.  (Data gleaned 
from the Programming Language Genealogy Project at everything2.com.)

More information about the Python-list mailing list