You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Documentation for email.charset confusing about the location of constants #77630
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2018-05-09.17:38:58.133>labels= ['3.11', 'type-bug', '3.9', '3.10', 'docs']
title='Documentation for email.charset confusing about the location of constants'updated_at=<Date2021-12-19.00:41:56.401>user='https://bugs.python.org/FrancoisLabelle'
When mentioning the constants contained in the module email.charset, the documentation prefixes them with "Charset", for example: Charset.QP, Charset.BASE64, Charset.SHORTEST. This suggests that the constants can be found on the class "Charset" (uppercase first letter) in the module, while they are in fact contained in the the "charset" (lowercase first letter) module itself.
This is probably a left-over from when the module was called email.Charset (in 2.2 I believe). Under Python 2.7, while the documentation uses the same nomenclature, at least the module is also importable under the name email.Charset so it makes more sense.
"If the character set must be encoded before it can be used in an email header, this attribute will be set to Charset.QP (for quoted-printable), Charset.BASE64 (for base64 encoding), or Charset.SHORTEST for the shortest of QP or BASE64 encoding. Otherwise, it will be None."
Ah, I see. Yes, those strings are actually hardcoded in the documentation source instead of being references. You are correct, they should be fixed. Note, however, that Charset is part of the legacy API and isn't actually used if you use the new API in python3.
Activity
FrancoisLabelle commentedon May 9, 2018
When mentioning the constants contained in the module email.charset, the documentation prefixes them with "Charset", for example: Charset.QP, Charset.BASE64, Charset.SHORTEST. This suggests that the constants can be found on the class "Charset" (uppercase first letter) in the module, while they are in fact contained in the the "charset" (lowercase first letter) module itself.
This is probably a left-over from when the module was called email.Charset (in 2.2 I believe). Under Python 2.7, while the documentation uses the same nomenclature, at least the module is also importable under the name email.Charset so it makes more sense.
bitdancer commentedon May 10, 2018
Can you provide an example of where this occurs in the docs?
quantumomega commentedon May 10, 2018
Original poster here (OpenID just wouldn't work anymore).
For instance: https://docs.python.org/2/library/email.charset.html
Under "class email.charset.Charset"
Under "header_encoding"
"If the character set must be encoded before it can be used in an email header, this attribute will be set to Charset.QP (for quoted-printable), Charset.BASE64 (for base64 encoding), or Charset.SHORTEST for the shortest of QP or BASE64 encoding. Otherwise, it will be None."
bitdancer commentedon May 10, 2018
Ah, I see. Yes, those strings are actually hardcoded in the documentation source instead of being references. You are correct, they should be fixed. Note, however, that Charset is part of the legacy API and isn't actually used if you use the new API in python3.
gh-77630: Change Charset to charset (GH-92439)
pythongh-77630: Change Charset to charset (pythonGH-92439)
pythongh-77630: Change Charset to charset (pythonGH-92439)
[3.10] gh-77630: Change Charset to charset (GH-92439) (GH-92476)
[3.9] gh-77630: Change Charset to charset (GH-92439) (GH-92477)
[3.9] pythongh-77630: Change Charset to charset (pythonGH-92439) (pyt…