Comment 2 for bug 244769

Revision history for this message
James Henstridge (jamesh) wrote :

This is due to choice of the __eq__() method. For "Bar.foo == Foo.id", Reference.__eq__() is executed which generates a correct expression object.

For "Foo.id == Bar.foo", Comparable.__eq__() is executed, which tries to convert Bar.foo (a Reference object) to an integer, which gives a TypeError. Perhaps some of these rich comparison methods should be returning NotImplemented instead? That would allow Reference.__eq__() to have a go in this second case.