[Mesa-dev] [PATCH 15/26] python: Specify the template output encoding

Dylan Baker dylan at pnwbakers.com
Tue Aug 7 20:27:34 UTC 2018


Quoting Mathieu Bridon (2018-07-06 02:34:56)
> 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

Eh, it's not a big deal either way. Lets just leave this as-is for now and we
can change it later if we decide we'd prefer to do that. Like when we drop
python 2.7 support.

Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180807/0f801a8c/attachment.sig>


More information about the mesa-dev mailing list