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

Victor Stinner victor.stinner at gmail.com
Mon Jun 12 10:00:14 EDT 2017


2017-06-12 15:28 GMT+02:00 INADA Naoki <songofacandy at gmail.com>:
>> 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.

My point is that LANG=C is easy to remember and "it just works".

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

I just propose to remove the warning, so LANG=C would "just works" as
well with Python 3.7.

>> 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?
>
> b) don't show warning when locale is coerced.

Always remove the warning.

>> 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.

Sorry, I don't understand. Currently, Python 3.7 "just works": it uses
UTF-8 when the locale is C and so we don't get any UnicodeError
anymore.

Why would user need to be annoyed by a warning while Python just do
the "right thing" for them?

> And I fear about overriding locale silently.

The thing is nobody understand locales :-) No need to annoy users
about locales. Just fix them silently ;-)

>  But there may be someone who prefer strict,
> ascii-only C locale.  This warning tells how to disable coercion for them.

Users who understand locales don't need such warning. They know how to
read a documentation and how to use properly locales :-)


> -1 for disable coercion by default:  It's too unhelpful for beginners.

Are you proposing to reject the PEP that you approved? Now I'm confused.

Victor


More information about the Python-Dev mailing list