[Python-Dev] doctest and pickle

Ethan Furman ethan at stoneleaf.us
Fri Jun 7 19:55:59 CEST 2013

On 06/07/2013 10:50 AM, Mark Janssen wrote:
>>      >>> from pickle import dumps, loads
>>      >>> Fruit.tomato is loads(dumps(Fruit.tomato))
>>      True
> Why are you using is here instead of ==?

I'm using `is` because I'm verifying that the instance returned by `pickle.loads` is the exact same object as the 
instance fed into `pickle.dumps`.  Enum members should be singletons.

> You're making a circular loop using "is"



More information about the Python-Dev mailing list