steenzout.object

Steenzout Python objects.


Keywords
python
License
Apache-2.0
Install
pip install steenzout.object==1.0.10

Documentation

python-object

pypi Build Status Code Health Coverage Status Requirements Status Documentation Status

License Project Stats

The steenzout.object package provides an Object class with pre-defined __hash__, __eq__ and __ne__ functions.

What's the difference to the object class?

Example:

>>> o1 = object()
>>> o2 = object()
>>> 
>>> assert o1 == o2
>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError

If you use steenzout.object.Object:

>>> from steenzout.object import Object
>>> 
>>> o1 = Object()
>>> o2 = Object()
>>> 
>>> assert o1 == o2
>>>

If you sub-class the Object class, == and != will still work as expected:

>>> class A(Object):
>>>     pass
... 
... 

>>> class B(Object):
>>>     pass
... 
... 

>>> a = A()
>>> b = B()

>>> a == b
>>> False

>>> a != b
>>> True

Test

$ tox

Documentation

$ tox -e docs

Links