summaryrefslogtreecommitdiff
path: root/Doc/library/enum.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/enum.rst')
-rw-r--r--Doc/library/enum.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst
index 686470534d..14dcfa7ad7 100644
--- a/Doc/library/enum.rst
+++ b/Doc/library/enum.rst
@@ -463,6 +463,12 @@ Some rules:
3. When another data type is mixed in, the :attr:`value` attribute is *not the
same* as the enum member itself, although it is equivalant and will compare
equal.
+4. %-style formatting: `%s` and `%r` call :class:`Enum`'s :meth:`__str__` and
+ :meth:`__repr__` respectively; other codes (such as `%i` or `%h` for
+ IntEnum) treat the enum member as its mixed-in type.
+5. :class:`str`.:meth:`__format__` (or :func:`format`) will use the mixed-in
+ type's :meth:`__format__`. If the :class:`Enum`'s :func:`str` or
+ :func:`repr` is desired use the `!s` or `!r` :class:`str` format codes.
Interesting examples