Re: Conventions for dummy name



Hallöchen!

Ben Finney writes:

"Diez B. Roggisch" <deets@xxxxxxxxxxxxx> writes:

The underscore is used as "discarded" identifier. So maybe

for _ in xrange(10):
...

The problem with the '_' name is that it is already well-known and
long-used existing convention for an entirely unrelated purpose:
in the 'gettext' i18n library, the '_' function to get the
locally-translated version of a text string.

Right, that's because I've used "__" where not all returning values
are interesing to me such as

a, b, __ = function_that_returns_three_values(x, y)

However, in loops, I prefer real names, even if the loop variable
isn't used outside.

Tschö,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: bronger@xxxxxxxxxx
(See http://ime.webhop.org for further contact info.)
.



Relevant Pages

  • SV: Conventions for dummy name
    ... Torsten Bronger wrote: ... Ben Finney writes: ... long-used existing convention for an entirely unrelated purpose: ...
    (comp.lang.python)
  • Re: Naming conventions
    ... Ben Finney wrote: ... convention is to use CamelCase for classes names (unless you have ... a strong reason to do otherwise). ...
    (comp.lang.python)
  • Re: I dont like what they call "Last name"
    ... Ben Finney wrote: ... person's name with family name in UPPERCASE. ... useful in writing systems that have such a thing. ... That convention is followed in several places. ...
    (sci.lang.japan)
  • Re: name of client module
    ... Ben Finney wrote: ... The convention in this forum is trimmed-quote, ...
    (comp.lang.python)