3.1. qupulse.comparable

This module defines the abstract Comparable class.

Classes

Comparable()

An object that can be queried for equality with other Comparable objects.

class qupulse.comparable.Comparable[source]

Bases: object

An object that can be queried for equality with other Comparable objects.

Subclasses must override the abstract property _compare_key which shall provide some object natively equatable in Python (e.g., strings, numbers, tuples containing those, etc..). Comparable provides implementations of the hashing function as well as the equals and not-equals operators based on comparison of this key.

abstract property compare_key: Hashable

Return a unique key used in comparison and hashing operations.

The key must describe the essential properties of the object. Two objects are equal iff their keys are identical.