You diff objects, you find out why they ain't the same.


Keywords
diff, difference, protocol
License
MIT
Install
pip install diff==2023.12.6

Documentation

diff

PyPI version Supported Python versions Build status pre-commit.ci status

diff defines a difference protocol. Watch:

>>> class LonelyObject:
...     def __diff__(self, other):
...         return f"{self} is not like {other}"
...
...     def __repr__(self):
...         return "<LonelyObject>"

>>> from diff import diff
>>> diff(LonelyObject(), 12).explain()
'<LonelyObject> is not like 12'