[Python-Dev] Pickling of Enums

Serhiy Storchaka storchaka at gmail.com
Sat Feb 15 20:01:36 CET 2014

How Enum items should be pickled, by value or by name?

I think that Enum will be used to collect system-depending constants, so 
the value of AddressFamily.AF_UNIX can be 1 on one platform and 2 on 
other. If pickle enums by value, then pickled AddressFamily.AF_INET on 
on platform can be unpickled as AddressFamily.AF_UNIX on other platform. 
This looks weird and contrary to the nature of enums.

More information about the Python-Dev mailing list