-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
The docs for email.mime types incorrectly identify bytes as strings #101021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
bkline
added a commit
to bkline/cpython
that referenced
this issue
Jan 13, 2023
The existing documentation refers to binary parameters as "strings" when they are actually bytes. Fixes python#101021
My guess is that all of this language is holdovers from the Python 2 days, so it's worth cleaning up. |
bkline
added a commit
to bkline/cpython
that referenced
this issue
Jan 14, 2023
The existing documentation refers to binary parameters as "strings" when they are actually bytes. Fixes python#101021
bkline
added a commit
to bkline/cpython
that referenced
this issue
Jan 14, 2023
The existing documentation refers to binary parameters as "strings" when they are actually bytes. Fixes python#101021
bkline
added a commit
to bkline/cpython
that referenced
this issue
Jan 14, 2023
The existing documentation refers to binary parameters as "strings" when they are actually bytes. Fixes python#101021
bkline
added a commit
to bkline/cpython
that referenced
this issue
Jan 14, 2023
The existing documentation refers to binary parameters as "strings" when they are actually bytes. Fixes python#101021
warsaw
pushed a commit
that referenced
this issue
Jan 14, 2023
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Jan 14, 2023
(cherry picked from commit 49cae39) Co-authored-by: Bob Kline <[email protected]>
miss-islington
added a commit
that referenced
this issue
Jan 14, 2023
(cherry picked from commit 49cae39) Co-authored-by: Bob Kline <[email protected]>
warsaw
added a commit
that referenced
this issue
Jan 15, 2023
…101052) (cherry picked from commit 49cae39) Co-authored-by: Bob Kline <[email protected]> Co-authored-by: Bob Kline <[email protected]>
bkline
added a commit
to NCIOCPL/cdr-lib
that referenced
this issue
Jan 18, 2023
The documentation for the email class was misleading (see bug report python/cpython#101021), and could be read as implying that the argument to the MIME...() constructors should be bytes, but that's not right.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Documentation
For example:
or
So the programmer thinks, "how can it be a 'string' and 'raw' at the same time?" Then the programmer notices the parameter for encoding and the language saying "the default encoding is Base64" and thinks, "ah, ok, that's how it could be a string!" (though it's still a little bit squirrelly to use the word "raw" to describe encoded data).
But then the reader sees the future tense in "... which will perform the actual encoding..." and thinks, "no, the argument must really be for binary data."
And then the programmer notices the parallel language in text.py:
and starts to wonder: "huh, maybe all of these are expecting bytes." But then the programmer's code blows up when it tries to go with that theory (still no help from the documentation).
So in desperation, the programmer starts to dig into the actual code to find out what's done for each of these subclasses. And that journey leads to the conclusion that "string" in this package means one thing for some of the classes and something different for others.
Can't we just say "bytes" when we mean bytes, and reserve the use of the word "string" to mean what it's supposed to mean in the only versions of Python which are actually officially supported? 😆
Linked PRs
The text was updated successfully, but these errors were encountered: