[Python-ideas] Why decode()/encode() name is harmful

Ian Cordasco graffatcolmingov at gmail.com
Fri May 29 21:47:25 CEST 2015


On Fri, May 29, 2015 at 3:56 AM, anatoly techtonik <techtonik at gmail.com> wrote:
> First, let me start with The Curse of Knowledge
> https://en.wikipedia.org/wiki/Curse_of_knowledge
> which can be summarized as:
>
> "Once you get something, it becomes hard
> to think how it was to be without it".
>
> I assume that all of you know difference between
> decode() and encode(), so you're cursed and
> therefore think that getting that right it is just a
> matter of reading documentation, experience and
> time. But quite a lot of had passed and Python 2
> is still there, and Python 3, which is all unicode
> at the core (and which is great for people who
> finally get it) is not as popular. So, remember that
> you are biased towards (or against)
> decode/unicode perception.
>
>
> Now imaging a person who has a text file. The
> person need to process that with Python. That
> person is probably a journalist and doesn't know
> anything that "any developer should know about
> unicode". In Python 2 he just copy pastes regular
> expressions to match the letter and is happy. In
> Python 3 he needs to *convert* that text to unicode.
>
> Then he tries to read the documentation, it
> already starts to bring conflict to his mind. It says
> to him to "decode" the text. I don't know about you,
> but when I'm being told to decode the text, I
> assume that it is crypted, because I watched a
> few spy movies including ones with Sherlock
> Holmes and Stierlitz. But the text looks legit to me,
> I can clearly see and read it and now you say that
> I need to decode it. You're basically ruining my
> world right here. No wonder that I will resist. I
> probably stressed, has a lot of stuff to do, and you
> are trying to load me with all those abstract
> concepts that conflict with what I know. No way!
> Unless I have a really strong motivation (or
> scientific background) there is no chance to get
> this stuff for me right on this day. I will probably
> repeat the exercise and after a few tries will get
> the output right, but there is no chance I will
> remember this thing on that day. Because
> rewiring neural paths in my brain is much harder
> that paving them from scratch.
> --
> anatoly t.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

So, ignoring your lack of suggestions for different names, would you
also argue that the codecs module (which is how people should be
handling this when dealing with files on disk) should also be renamed?
codecs is a portmanteau of coder-decoder and deals with converting the
code-points to bytes and back. codecs, "Encoding", and "Decoding" are
also used for non-text formats too (e.g., files containing video or
audio). They in all of the related contexts they have the same
meaning. I'm failing to understand your problem with the terminology.


More information about the Python-ideas mailing list