On 06/07/2013 10:54 AM, Mark Janssen 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. In most cases, sure. But one of the invariants of Enums is that there is only ever one of each member specifically so that `is` tests work. -- ~Ethan~
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4