[Python-Dev] doctest and pickle
R. David Murray
rdmurray at bitdance.com
Fri Jun 7 20:11:59 CEST 2013
More information about the Python-Dev mailing list
Fri Jun 7 20:11:59 CEST 2013
- Previous message: [Python-Dev] doctest and pickle
- Next message: [Python-Dev] doctest and pickle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, 07 Jun 2013 10:54:57 -0700, Mark Janssen <dreamingforward at gmail.com> wrote: > On Fri, Jun 7, 2013 at 10:50 AM, Mark Janssen <dreamingforward at gmail.com> wrote: > >> >>> from pickle import dumps, loads > >> >>> Fruit.tomato is loads(dumps(Fruit.tomato)) > >> True > > > > Why are you using is here instead of ==? You're making a circular > > loop using "is" > > I should add that when you're serializing with pickle and then > reloading, the objects should be seen as "essentially equivalent". > This means that they are either byte-by-byte equivalent (not sure > actually if Python actually guarantees this), or every element would > still compare equal and that is what matters. Enums are supposed to be singletons, though, so the 'is' test is exactly the point of this test. --David
- Previous message: [Python-Dev] doctest and pickle
- Next message: [Python-Dev] doctest and pickle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list