[GRASS-dev] [Issue] String formatting issue

Sanjeet edu.sanjeet at gmail.com
Mon Jun 4 10:52:24 PDT 2018


On Mon, Jun 4, 2018 at 3:54 AM, Nikos Alexandris
<nik at nikosalexandris.net> wrote:
> * Sanjeet <edu.sanjeet at gmail.com> [2018-06-03 18:08:29 -0600]:
>>
>> I can resolve this by using fomat() like this:
>> msg = _(("Module run {} {} ended with error").format(module,code))
>>
>> Do you think this is a good way to resolve this?
>> Is "format()" going to work well with translations using the
>> ''gettext()'' used as _() as shown in the above line?
>
> Normally everyone would want to follow the "new" style of formatting
> strings, which offers many more options. Why stick to the old style,
> i.e. using the % notation?

Hi Nikos,

Yes, the .format() style should be followed in most cases. I could be
wrong but I guess the old style has been used to support older
versions of Python. But it seems we can use the 'format' style since
we are only keeping support for Python 2.7 (or 2.6 if possible).

Sanjeet


More information about the grass-dev mailing list