On Sat, Mar 7, 2015 at 8:41 AM, Chris Angelico <rosuav@gmail.com> wrote:
> If it says "decode", the result is a Unicode string. If it says
> "encode", the result is bytes. I'm not sure what is difficult here.
Yep. When I teach, I use this mnemonic, which I can now quote from my
book [1] ;-)
[TIP]
====
If you need a memory aid to distinguish `.decode()` from `.encode()`,
convince yourself that a Unicode `str` contains "human" text, while
byte sequences can be cryptic machine core dumps. Therefore, it makes
sense that we *decode* `bytes` to `str` to get human readable text,
and we *encode* text to `bytes` for storage or transmission.
====