On Wed, 1 Sept 2021 at 01:20, Matthias Bussonnier < bussonniermatth...@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
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/7Q2R3AEV5GL4Y3JMZXQWZJGJQ4HELB5T/ Code of Conduct: http://python.org/psf/codeofconduct/