[Mesa-dev] [PATCH 15/26] python: Specify the template output encoding
Mathieu Bridon
bochecha at daitauha.fr
Fri Jul 6 09:34:56 UTC 2018
On Thu, 2018-07-05 at 09:14 -0700, Dylan Baker wrote:
> Does it make more sense to encode, or to use io.open and open the
> file in text mode? I've gone back and forth on this myself several
> times.
Same here, both seem equally valid and I can't really make my mind up
on which one to pick.
The general recommendation with Python 3 is to use unicode strings
everywhere, and only encode/decode at the boundaries.
I guess the boundary is actually writing to the file, so opening it in
text mode and handling unicode strings (not encode them ourselves) fits
that a bit better?
It seems like a very weak argument though in this specific case, since
we're not really doing anything with the byte-string other than just
writing it directly to the file.
Do you want me to do a v2 with that change?
--
Mathieu
More information about the mesa-dev
mailing list