On Sun, Nov 9, 2008 at 3:36 PM, jmay <[EMAIL PROTECTED]> wrote:

> It appears that entities cannot be compared directly:
>
>  e1 = MyEntity.get('longkeystringhere')
>  e2 = MyEntity.get('samekeystringhere')
>
> "e1 == e2" will return False even if identical keys are provided.
>
> But 'e1.key() == e2.key()' returns True.

That makes perfect sense because you might have changed e2's
properties (and even saved e2). If you want to make your entities
comparable, you should define a __cmp__ function on the entity class
yourself. Also, if you're going to use them as dictionary keys, define
a __hash__ function as well.


Dave.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to