__eq__

The dunder method that defines what == means for your objects; without it, two instances are equal only if they are the same object.

In more detail

Defining __eq__ removes the default __hash__, making instances unhashable until you define a matching __hash__. Objects that compare equal must have equal hashes.

Related terms

Taught in

References

Certification courses