[Python-Dev] Python3 "complexity" (was RFC: PEP 460: Add bytes...)
R. David Murray
rdmurray at bitdance.com
Thu Jan 9 02:24:06 CET 2014
On Thu, 09 Jan 2014 00:12:57 +0000, <kristjan at ccpgames.com> wrote:
> I think there might be a different analogy: Having to specify an
> encoding is like having strong typing. In Python 2.7, we _can_ forego
> that and just duck-type our strings :)
Python is a strongly typed language.
Saying that python2 let you duck type bytestrings (ie: postpone the
decision as to what encoding they were in until the last minute) is an
interesting perspective...but as we know it led to many many program bugs.
Which were the result, essentially, of a failure to strongly type the
string and bytes types the way other python types are strongly typed.
However, I do now understand your use case better, even though I wouldn't
myself write programs like that. Or, rather, I make sure all my files
are in the same encoding (utf-8). I suppose that this is because I,
as an English-speaking USAian, came late to the need for non-ascii
characters, after utf-8 was already well established. The rest of
the world didn't have that luxury.
More information about the Python-Dev