5

In Python it is good practice to use a single underscore for intentionally unused variables:

first_word, _ = 'only only is important'.split(' ', 1)

On the other hand, gettext uses the underscore as a short alias for its translation function, leading to clashes if the underscore is used for a variable before:

print(_('gettext will try to translate this string.'))

Question: What is the convention for the name of throwaway variables if gettext is used in the same namespace?

piripiri
  • 1,925
  • 2
  • 18
  • 35

0 Answers0