Comparisons¶
Return string representation without line breaks.
- Return type
Check if self and other can be non-contradictory.
- Return type
- Returns
a bool indicating whether there’s at least one way to match the
context_factors
ofself
andother
, such that they fit the relationshipcomparison
.
Test whether
self
implies the absence ofother
.- Return type
- Returns
True
if self and other can’t both be true at the same time. Otherwise returnsFalse
.
Get
Factor
s used in comparisons with otherFactor
s.- Return type
FactorSequence
- Returns
a tuple of attributes that are designated as the
context_factors
for whichever subclass ofFactor
calls this method. These can be used for comparing objects usingconsistent_with()
Factor
s that can be replaced without changingself
s meaning.
Search of
self
andself
’s attributes forFactor
with specifiedname
.- Return type
Optional[Factor]
- Returns
a
Factor
with the specifiedname
attribute if it exists, otherwiseNone
.
Search of
self
andself
’s attributes forFactor
with specified string.- Return type
Optional[Factor]
- Returns
a
Factor
with the specified string if it exists, otherwiseNone
.
List ways to reorder
context_factors
but preserveself
’s meaning.The empty list is the default return value for subclasses that don’t have any interchangeable
context_factors
.- Return type
List
[ContextRegister
]- Returns
the ways
context_factors
can be reordered without changing the meaning ofself
, or whether it would be true in a particular context.
Test whether
other
impliesself
.
Test whether
self
impliesother
.- Return type
Test whether
self
impliesother
andself
!=other
.- Return type
Test whether
self
andother
have identical meanings.- Return type
- Returns
whether
other
is anotherFactor
with the same meaning asself
. Not the same as an equality comparison with the==
symbol, which simply convertsself
’s andother
’s fields to tuples and compares them.
Create new
Comparable
, replacing keys ofchanges
with values.- Parameters
changes (
ContextRegister
) – hasComparable
s to replace as keys, and has their replacements as the corresponding values.- Return type
- Returns
a new
Comparable
object with the replacements made.
Return attributes of
self
that aren’t inherited from another class.Used for getting parameters to pass to
__init__()
when generating a new object.
Get permutations of generic Factor assignments not ruled out by the known context.
- Parameters
other (
Comparable
) – anotherComparable
object with genericFactor
s- Yields
all possible ContextRegisters linking the two
Comparable
s- Return type
Iterator
[ContextRegister
]
Collect self’s
context_factors
, and theircontext_factors
, recursively.- Return type
- Returns
Find ways to update
self_mapping
to allow relationshipcomparison
.- Parameters
other (
Optional
[Comparable
]) – anotherComparable
being compared toself
register – keys representing
Comparable
s fromself
’s context and values representingComparable
s inother
’s context.comparison (
Callable
) – a function defining the comparison that must beTrue
betweenself
andother
. Could beComparable.means()
orComparable.__ge__()
.
- Yields
every way that
self_mapping
can be updated to be consistent withself
andother
having the relationshipcomparison
.- Return type
Iterator
[ContextRegister
]
Get one explanation of why self and other have the same meaning.
- Return type
Optional
[ContextRegister
]
Get one explanation of why self and other need not contradict.
- Return type
Optional
[ContextRegister
]
Get one explanation of why self and other contradict.
- Return type
Optional
[ContextRegister
]
Get one explanation of why self implies other.
- Return type
Optional
[ContextRegister
]
Get one explanation of why self implies other.
- Return type
Optional
[ContextRegister
]
Test whether
self
implies()
the absence ofother
.This should only be called after confirming that
other
is notNone
.- Return type
Iterator
[ContextRegister
]- Returns
True
if self and other can’t both be true at the same time. Otherwise returnsFalse
.
Generate
ContextRegister
s that cause self to imply other.If self is absent, then generate a ContextRegister from other’s point of view and then swap the keys and values.
- Return type
Iterator
[ContextRegister
]
list of weak references to the object (if defined)