Comment 3 for bug 331919

Revision history for this message
Guilherme Salgado (salgado) wrote :

IIUC, this bug is only about making a delegated object compare equally to another delegated object (when both have the same context)?

I ask that because I've been tempted to make delegated objects compare equally to their raw counterpart (delegated_bug == bug), and I even implemented __eq__ and __ne__ for lazr.delegates, but before I submitted that for review I realized it would also be nice to have them be identical so that they could be used interchangeably as, let's say, keys in dictionaries. Also, some other changes were necessary to fool Storm into thinking that a delegated_bug was a Bug, so that we could pass in delegated objects to storm. I kept encountering problems as I progressed, and at one point I finally realized it certainly wasn't a good idea to promote delegated objects to be used interchangeably with raw ones, so I backed out my changes and went with a completely different approach.

So, to summarize, I think it's a good idea to implement __eq__ and __ne__ as in the bug's description, but I'm not sure making delegated_bug compares equally to bug is a good idea.