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

Dave Benjamin ramen at lackingtalent.com
Fri Jul 30 12:35:36 EDT 2004


In article <mailman.944.1091149759.5135.python-list at python.org>, Terry Reedy wrote:
> 
> "Dave Benjamin" <ramen at lackingtalent.com> wrote in message
> news:slrncgj6j3.vte.ramen at lackingtalent.com...
>> In Python, it's possible to use _ multiple times in the same expression,
> 
> In Python, _ is a (non-keyword) name like any other.  It can be used like
> any other name.  In interactive mode, it is the default name bound to bare
> expressions, but it is still just a name.

Right, I guess what surprised me is that you can tuple-unpack to the same
variable repeatedly. I understand that there's nothing special about "_"
(aside from its special treatment in the interpreter).

Funny, I was sure that someone would nitpick about my misuse of the word
"expression". ;)

-- 
  .:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:.

"When the country is confused and in chaos, information scientists appear."
Librarian's Lao Tzu: http://www.geocities.com/onelibrarian.geo/lao_tzu.html



More information about the Python-list mailing list