SV: Conventions for dummy name
Torsten Bronger wrote:
Variable name "dummy" serves the same purpose, such as:
a, b, dummy = function_that_r eturns_three_va lues(x, y)
According to http://linux.die.net/man/1/pylint it is also possible to use the
option
--dummy-variables-rgx=<regexp>
to further specify which variable not to report as unused. As far as I can
tell, it defaults to '_|dummy'.
..david
Torsten Bronger wrote:
>Hallöchen!
>
>Ben Finney writes:
>
>
>Right, that's because I've used "__" where not all returning values
>are interesing to me such as
>
>a, b, __ = function_that_r eturns_three_va lues(x, y)
>
>Ben Finney writes:
>
>"Diez B. Roggisch" <deets@nospam.w eb.dewrites:
>>
>>
>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.
>>
>>The underscore is used as "discarded" identifier. So maybe
>>
>>for _ in xrange(10):
>> ...
>>
>>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_r eturns_three_va lues(x, y)
a, b, dummy = function_that_r eturns_three_va lues(x, y)
According to http://linux.die.net/man/1/pylint it is also possible to use the
option
--dummy-variables-rgx=<regexp>
to further specify which variable not to report as unused. As far as I can
tell, it defaults to '_|dummy'.
..david
Comment