[Python-Dev] doctest and pickle

Barry Warsaw barry at python.org
Fri Jun 7 21:33:26 CEST 2013


On Jun 07, 2013, at 02:30 PM, PJ Eby wrote:

>I don't know if enums *actually* preserve this invariant, but my
>default expectation of the One Obvious Way would be that enums, being
>uniquely-named objects that know their name and container, should be
>considered global objects in the same fashion as classes and
>functions, *and* that as singletons, they'd also be treated in the
>same way as None, Ellipsis, etc.  That is, there are two independent
>precedents for objects like that preserving "is" upon pickling and
>unpickling.

This is certainly how I thought of them in flufl.enum, and indeed the `is`
test in my own test suite proves that it works.

-Barry


More information about the Python-Dev mailing list