On Wed, 1 Sept 2021 at 01:20, Matthias Bussonnier <bussonniermatthias@gmail.com> wrote:
> Are there other such classes?
[snip] 
... stuff, let's pick a few:

sympy.physics.optics.Medium:

    def __eq__(self, other):
        return self.refractive_index == other.refractive_index

Will crash with None has no attribute refractive_index,

I think that particular __eq__ method is buggy. There should be a general expectation that __eq__ can be used with unexpected types and should return NotImplemented or False rather than raise an exception.


Oscar