summaryrefslogtreecommitdiffstats
path: root/Doc/howto/enum.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/howto/enum.rst')
-rw-r--r--Doc/howto/enum.rst11
1 files changed, 10 insertions, 1 deletions
diff --git a/Doc/howto/enum.rst b/Doc/howto/enum.rst
index 68b75c5..4312b4c 100644
--- a/Doc/howto/enum.rst
+++ b/Doc/howto/enum.rst
@@ -517,7 +517,16 @@ from that module.
nested in other classes.
It is possible to modify how enum members are pickled/unpickled by defining
-:meth:`__reduce_ex__` in the enumeration class.
+:meth:`__reduce_ex__` in the enumeration class. The default method is by-value,
+but enums with complicated values may want to use by-name::
+
+ >>> class MyEnum(Enum):
+ ... __reduce_ex__ = enum.pickle_by_enum_name
+
+.. note::
+
+ Using by-name for flags is not recommended, as unnamed aliases will
+ not unpickle.
Functional API