[Python-Dev] PEP 538 warning at startup: please remove it

INADA Naoki songofacandy at gmail.com
Mon Jun 12 09:28:31 EDT 2017


On Mon, Jun 12, 2017 at 6:46 PM, Victor Stinner
<victor.stinner at gmail.com> wrote:
> 2017-06-12 11:35 GMT+02:00 INADA Naoki <songofacandy at gmail.com>:
>> I think "Good practice" is set `LC_CTYPE=C.UTF-8` environment variable,
>> as warning says.
>
> I like using LANG=C to display a manual page in english.

Me too.  But we can use LC_CTYPE=C.UTF-8 with LANG=C.

And LC_CTYPE=C.UTF-8 is much easier (and ideal) than
PYTHONLOCALECOERCIONWARNING=0.

> Technically, I know that it's wrong, but it works. I don't see the point of the
> warning. I'm able to render my hello world with the wrong locale :-)
> If you want to use C.utf-8, fine, just do it, but don't bug me with
> locales please :-)

Do you mean which?

a) make locale coercion off by default.
b) don't show warning when locale is coerced.


> I consider that I understand well locales and encodings. But now try
> to imagine someone who don't know anything about programming and
> starts learning a new language, Python, and see this warning...

Locale coercion is for them.  Currently (Python 3.6), they will see
UnicodeEncodeError.
This warning is much helpful than UnicodeEncodeError, because
it teaches how to configure UTF-8 locale.

And I fear about overriding locale silently.  AFAIK, locale coercion is
very nice for most cases.  But there may be someone who prefer strict,
ascii-only C locale.  This warning tells how to disable coercion for them.

And there may be some surprising side effect of coercing location
we can't expect for now.  That's another reason why coercion shows warning.

But we use `surrogateescape` error handler for stdout in C locale already.
I may be too nervous about it.

So my vote is:

-1 for disable coercion by default:  It's too unhelpful for beginners.
-0.5 for disable warning NOW:  I don't think we know all side effects well.


Regards,


More information about the Python-Dev mailing list