summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2021-03-31 04:17:26 (GMT)
committerGitHub <noreply@github.com>2021-03-31 04:17:26 (GMT)
commitb775106d940e3d77c8af7967545bb9a5b7b162df (patch)
treea5146740d7fab61a70bf410e4f348a9525cb1fd4 /Doc/whatsnew
parent51a85ddce8b336addcb61b96f04c9c5edef07296 (diff)
downloadcpython-b775106d940e3d77c8af7967545bb9a5b7b162df.zip
cpython-b775106d940e3d77c8af7967545bb9a5b7b162df.tar.gz
cpython-b775106d940e3d77c8af7967545bb9a5b7b162df.tar.bz2
bpo-40066: Enum: modify `repr()` and `str()` (GH-22392)
* Enum: streamline repr() and str(); improve docs - repr() is now ``enum_class.member_name`` - stdlib global enums are ``module_name.member_name`` - str() is now ``member_name`` - add HOW-TO section for ``Enum`` - change main documentation to be an API reference
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/3.10.rst8
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index e09cfb4..ea2834b 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -716,6 +716,14 @@ encodings
:func:`encodings.normalize_encoding` now ignores non-ASCII characters.
(Contributed by Hai Shi in :issue:`39337`.)
+enum
+----
+
+:class:`Enum` :func:`__repr__` now returns ``enum_name.member_name`` and
+:func:`__str__` now returns ``member_name``. Stdlib enums available as
+module constants have a :func:`repr` of ``module_name.member_name``.
+(Contributed by Ethan Furman in :issue:`40066`.)
+
gc
--