Skip to main content

Comparable

This interface defines a contract for items that can be compared, specifically for use with a WeightedRandomList. It provides a single method, Compare, to determine the relationship between two Comparable objects.

Methods


Compare()

@classmethod
def Compare(
to: [Comparable](comparable.md?sid=flytestdlib_random_comparable)
) - > bool

Compares the current object with another Comparable object to determine their relative order or equality. This method is used by WeightedRandomList to establish a comparison logic between items.

Parameters

NameTypeDescription
to[Comparable](comparable.md?sid=flytestdlib_random_comparable)The other Comparable object to compare against the current object.

Returns

TypeDescription
boolReturns true if the comparison condition is met, false otherwise. The exact meaning of 'true' depends on the implementation of the Comparable interface.