Newb question: underscore

Ben Finney bignose+hates-spam at
Fri Jun 6 02:15:50 CEST 2008

Skye <spoier at> writes:

> What is this doing?
>     print >> fd, _(__doc__)

Without any context, it's impossible to know.

> I'm guessing line-splitting __doc__ into a list, but what's that
> leading underscore do?

Look at the rest of the module to see where that name comes from;
perhaps an assignment, or an 'import foo as _'.

My guess would be someone has used the common convention of naming the
"get the corresponding localised version of this string from the
application's gettext database" function as '_' for convenience.

That's only a guess though; you should believe the code you have in
front of you, not my guesses.

 \       "Pinky, are you pondering what I'm pondering?" "Well, I think |
  `\    so, Brain, but 'apply North Pole' to what?"  -- _Pinky and The |
_o__)                                                           Brain_ |
Ben Finney

More information about the Python-list mailing list