On Wed, Feb 10, 2021 at 1:46 AM Anders Munch <ajm(a)flonidan.dk> wrote:
>> How about swapping around "locale" and None?
Inada Naoki <songofacandy(a)gmail.com> wrote:
>
> I thought it, but it may not work. Consider about function like this:
>
> ```
> def read_text(self, encoding=None):
> with open(self._filename, encoding=encoding) as f:
> return f.read()
> ```
>
> If `encoding=None` suppresses the warning, functions like this never warned.
I don't see why they should be. The author clearly knew about the encoding
argument to open, they clearly intended for a None value to be given in some
cases, and at the time of writing None meant to use a locale-dependent encoding.
> We are not discussing about changing default encoding for now.
The section "Prepare to change the default encoding to UTF-8" gave me the
impression that this was meant as a stepping stone on the way to doing just
that. If that was not the intention, my apologies for the misread.
regards, Anders