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

Dave Benjamin ramen at lackingtalent.com
Fri Jul 30 12:39:28 EDT 2004


In article <2mui6cFq81c0U1 at uni-berlin.de>, Heike C. Zimmerer wrote:
> Dave Benjamin <ramen at lackingtalent.com> writes:
> 
>> In Python, it's possible to use _ multiple times in the same expression,
> 
> There is, however, one objection to the use of _ as a placeholder for
> a dummy variable: it is used by the gettext module.  So if a program
> may be subject to internationalization, it is advisable to keep this
> name reserved, or you may run into problems.

Speaking of which, am I the only one here that sees this _() function as a
total hack? Usually, having a one-character function (and a global one at
that!) would be considered outrageous, and why not have global string
constants instead of looking up complete sentences as keys in a mapping
table? Not that I could propose a better solution if you're trying to make
an already existing, large application multilingual, but still...

-- 
  .:[ 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