[Python-Dev] Python3 "complexity" (was RFC: PEP 460: Add bytes...)

R. David Murray rdmurray at bitdance.com
Thu Jan 9 00:40:39 CET 2014


On Wed, 08 Jan 2014 22:04:56 +0000, <kristjan at ccpgames.com> wrote:
> Believe it or not, sometimes you really don't care about encodings.
> Sometimes you just want to parse text files.  Python 3 forces you to
> think about abstract concepts like encodings when all you want is to
> open that .txt file on the drive and extract some phone numbers and
> merge in some email addresses.  What encoding does the file have?  Do
> I care?  Must I care?

Why *do* you care?  Isn't your system configured for utf-8, and all your
.txt files encoded with utf-8 by default?  Or at least configured
with a single consistent encoding?  If that's the case, Python3
doesn't make you think about the encoding.  Knowing the right encoding
is different from needing to know the difference between text and bytes;
you only need to worry about encodings when your system isn't configured
consistently to begin with.

If you do have to care, your little utilities only work by accident in
Python2, and must have produced mojibake when the encoding was wrong,
unless I'm completely confused.  So yeah, sorting that out is harder if
you were just living with the mojibake before...but if so I'm surprised
you haven't wanted to fix that before this.

--David


More information about the Python-Dev mailing list