Arek Bulski wrote:
def __glob_eq__(a,b):
  if not a == b:
      raise FoundInequalityError(a,b)
  return True

assert obj1 == obj2   #<-- using eq above

How would you ensure that this overriding only applied in
the places you want it? You don't want to change the meaning
of == in the code under test!

Related to that, how would you prevent the use of ==
in the definition of __glob_eq__ above from triggering infinite
recursion?

--
Greg
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to